Skip to the page

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.

The 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/playwright tests 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.push returns nothing; wrap it in useTransition to show pending UI. useLinkStatus gives a pending hint for slow networks.
  • Client cache freshness comes from cacheLife stale (minimum 30 s) or staleTimes; 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.push returns a promise you can await"

    Fix: it queues a transition and returns immediately.

Easy to hard

Questions interviewers ask, easy to hard

  1. What is the difference between <Link> and <a> in Next.js?
  2. How does prefetching work for static and dynamic routes?
  3. Why did App Router navigations sometimes feel slower than an SPA, and what did 16.x change?
  4. Every visible link prefetches a whole message thread. How do you limit it?
  5. 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 voice

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview