Not-found page handling
📖 Scenario: You are building a website using Next.js. You want to show a friendly message when users visit a page that does not exist.
🎯 Goal: Create a custom not-found.tsx file that displays a simple message for missing pages in your Next.js app.
📋 What You'll Learn
Create a
not-found.tsx file inside the app directoryExport a default React functional component named
NotFoundThe component should return a
<main> element with a heading <h1> that says exactly: Page Not FoundAdd a paragraph
<p> below the heading with the text: Sorry, the page you are looking for does not exist.Use semantic HTML and ensure the component is accessible
💡 Why This Matters
🌍 Real World
Custom not-found pages improve user experience by showing friendly messages when users visit invalid URLs.
💼 Career
Knowing how to handle 404 pages is essential for web developers working with Next.js or any modern web framework.
Progress0 / 4 steps