App Router foundations · senior
Navigation, prefetching and the client cache
<Link> makes client-side transitions that keep shared layouts and fetch only changed segments, and it prefetches routes as links enter the viewport; Next.js 16 rewrote prefetching (layout dedup, incremental), 16.3 added Partial Prefetching and Instant Navigations, and 16.4 added navigation()/prefetch() to control what is prefetched.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
<Link>vs<a>: Link does a client-side transition (no full reload, shared layouts and their state kept, scroll handled) and prefetches;<a>does a full page load.- Prefetching runs only in production builds. Without Partial Prefetching: static routes are prefetched fully; dynamic routes are skipped or partially prefetched when they have
loading.tsx. - Next 16: shared layouts downloaded once for many links (layout deduplication), only missing parts fetched (incremental), requests cancelled when a link leaves the viewport, re-prefetch after invalidation.
- 16.3 Partial Prefetching (
partialPrefetching: true, part of the Cache Components model): every link prefetches the route's App Shell;<Link prefetch={true}>also prefetches cached content that depends on URL params (costs a server call per link). Instant Insights and the Navigation Inspector show slow navigations;instant()from@next/playwrighttests them. - 16.4:
await navigation()keeps content out of prefetches (load only on real navigation);await prefetch()keeps content out of the shell until an explicit prefetch. - Client hooks (client components only) from
next/navigation:useRouter(push, replace, back, refresh, prefetch),usePathname,useSearchParams,useParams.router.pushreturns nothing; wrap it inuseTransitionto show pending UI.useLinkStatusgives a pending hint for slow networks. - Client cache freshness comes from
cacheLifestale(minimum 30 s) orstaleTimes; any revalidation call from a Server Action clears the client cache.router.refresh()re-fetches the current route without losing client state. - Large lists of links: limit prefetching (
prefetch={false}, prefetch on hover) to save server work.
The red pen
Common traps: mistake → fix
Mistake: "Prefetching works in
next dev"Fix: it is disabled in development.
Mistake: "Prefetch everything with
prefetch={true}"Fix: every visible link can trigger a server render; be selective.
Mistake: "
router.pushreturns a promise you can await"Fix: it queues a transition and returns immediately.
Easy to hard
Questions interviewers ask, easy to hard
- What is the difference between
<Link>and<a>in Next.js? - How does prefetching work for static and dynamic routes?
- Why did App Router navigations sometimes feel slower than an SPA, and what did 16.x change?
- Every visible link prefetches a whole message thread. How do you limit it?
- How would you test that a navigation stays instant?
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.