Complete the code to create a basic Not Found page component in Next.js.
export default function NotFound() {
return <h1>[1]</h1>;
}The Not Found page should clearly indicate the page is missing, so "Page not found" is the best message.
Complete the code to add a button that navigates back to the home page using Next.js Link.
import Link from 'next/link'; export default function NotFound() { return ( <div> <h1>Page not found</h1> <Link href=[1]> <a>Go Home</a> </Link> </div> ); }
The home page URL is "/", so the Link should point there to navigate home.
Fix the error in the Not Found component by correctly importing the useRouter hook from Next.js.
import [1] from 'next/router'; export default function NotFound() { const router = useRouter(); return <button onClick={() => router.push('/')}>Go Home</button>; }
The correct hook to import for routing in Next.js is useRouter from 'next/router'.
Fill both blanks to create a Not Found page that uses a semantic <main> and includes an aria-label for accessibility.
export default function NotFound() {
return (
<[1] aria-label=[2]>
<h1>Page not found</h1>
</[1]>
);
}Using main marks the main content area, and aria-label="main content" helps screen readers understand the section.
Fill all three blanks to create a responsive Not Found page with a centered message and a button styled using Tailwind CSS.
export default function NotFound() {
return (
<div className=[1]>
<h1 className=[2]>Page not found</h1>
<button className=[3]>Go Home</button>
</div>
);
}The container uses flexbox to center content vertically and horizontally. The heading is large and bold with margin below. The button has blue background, white text, padding, rounded corners, and focus styles for accessibility.