Performance: Not-found.tsx customization
MEDIUM IMPACT
This affects the page load speed and user experience when a user navigates to a non-existent route, impacting the Largest Contentful Paint (LCP) and Interaction to Next Paint (INP).
export default function NotFound() { return <div><h1>Page Not Found</h1><p>Sorry, we couldn't find that page.</p></div>; }
export default async function NotFound() { const data = await fetch('https://api.example.com/slow-endpoint').then(res => res.json()); return <div>{data.message}</div>; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Blocking data fetch in NotFound | Moderate (due to data rendering) | 1+ reflows triggered by delayed content | High paint cost due to delayed render | [X] Bad |
| Static simple NotFound component | Low (minimal DOM nodes) | Single reflow | Low paint cost with immediate render | [OK] Good |