0

loading / error / not-found

Routingused in ~78% of apps

Every real route has three failure stories the happy path ignores: it is still loading, it crashed, or the thing you asked for does not exist. Next.js gives you one special file for each — but tutorials get the rules wrong, and an interviewer will catch you the moment you say "error.tsx is a Server Component."

Core idea. Three filename conventions wrap a route segment in safety nets: `loading.tsx` is an automatic Suspense fallback (you never write `<Suspense>` yourself), `error.tsx` is an error boundary that MUST be a Client Component, and `not-found.tsx` renders when you call `notFound()`.
Playground, this isn't a screenshot
statusIDLE
→→→
what the user sees
Nothing requested yet
pick a status above
→12 more in your feed
loading indicator

Greyed placeholders shaped like the real content — best for feeds, cards, lists.

SPACE RESERVED

The skeleton is sized to the final layout, so the footer below stays put — zero layout shift.

Every async UI lives in one of four states: idle → loading → error or success. Toggle skeleton vs spinner while in loading to feel the layout shift.

↑ play a little first, then dig in