Performance: Not-found page handling
MEDIUM IMPACT
This affects the page load speed and user experience when a user navigates to a non-existent route.
import { notFound } from 'next/navigation'; export default function Page() { // Next.js built-in to trigger 404 notFound(); return null; }
export default function Page() { return <div>Page not found</div>; } // No special 404 handling, no status code set
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Client-side 404 rendering without status | Moderate (full page DOM) | Multiple (full layout) | High (full paint) | [X] Bad |
| Server-side 404 with notFound() | Minimal (error page DOM) | Single reflow | Low (simple paint) | [OK] Good |