BitlystBitlyst
PostsSeriesTopicsAbout

Bitlyst

Short, diagram-first posts on JavaScript, React & Next.js. Follow via RSS or the newsletter.

© 2026 Mohsen Fallahnejad

PostsSeriesTopicsLinksAboutRSSGitHubX
Posts/nextjs
Intermediate2 min read

Prefetching in Next.js Links Explained

How Next.js prefetch works in <Link>, why it makes navigation fast, and when to disable it.

Mohsen Fallahnejad

Mohsen Fallahnejad

Oct 4, 2025Discuss

🚦 What is prefetch?#

In Next.js, <Link> can prefetch the code + data for the target page before you click.
That means when the user actually clicks, navigation feels instant.


⚙️ How it works under the hood#

  1. When a <Link> appears in the viewport, Next.js triggers a prefetch request:

    • The JavaScript bundle for that route.
    • In App Router (/app), also the React Server Component (RSC) payload.
  2. Prefetching uses an IntersectionObserver so links outside the screen aren’t prefetched unnecessarily.

  3. If you hover/focus a link, Next.js may also prefetch aggressively.

  4. When you click, Next.js already has the assets in the router cache, so navigation happens with zero extra network latency.


🛠 Usage#

tsx
import Link from "next/link";

export default function Home() {
  return (
    <nav>
      {/* Prefetch ON (default in production) */}
      <Link href="/about">About</Link>

      {/* Explicitly disable prefetch */}
      <Link href="/contact" prefetch={false}>
        Contact
      </Link>
    </nav>
  );
}
  • ✅ Default in production: <Link> prefetches.
  • ⚠️ Development mode: Prefetching is disabled (to avoid interfering with HMR).

📦 App Router specifics (Next.js 13+)#

  • Prefetch loads both the code bundle and the RSC payload (.rsc file).
  • These are stored in the Router cache, so clicking doesn’t trigger a new fetch unless stale.
  • With fetch inside Server Components, cache control (force-cache, no-store) determines whether the prefetched data is reused or refetched.

🎯 When to disable prefetch#

  • If you render too many links (e.g., a large list/table), prefetching all would waste bandwidth.
  • In those cases, use prefetch={false} or dynamically load links only when visible.

🧠 Mental model#

  • <Link prefetch> = “warm up the router with everything this page needs, before the user clicks.”
  • This is why Next.js apps often feel faster than plain SPAs: navigation happens instantly, without waiting for the network.

✅ Summary#

  • Next.js prefetch loads JS bundles + data when a link is visible.
  • Prefetch is enabled by default in production.
  • Use prefetch={false} when you have many links and want to avoid wasted requests.
  • In App Router, prefetch also warms up the RSC payload in the router cache.

✨ Result: smoother, almost instant page transitions.

Filed under#nextjs#link#prefetch#app router#performance

Was this worth your time?

One tap tells me what to write more of.

Mohsen Fallahnejad

Written by

Mohsen Fallahnejad

Frontend engineer explaining JavaScript, React & Next.js internals in posts you can finish over coffee. More about me

X ↗GitHub ↗LinkedIn ↗
← OlderWhy MUI Avoids Theme Flash on First Load (Dark/Light Mode)Newer →BroadcastChannel API in JavaScript

Start the discussion

Questions, corrections, a better approach? I read and reply to every comment.

Read next

Scrolling My Blog Index Prefetched All 51 Posts. One Config Line Cut It to 90 kB.

What a long list of Next.js <Link>s really costs in prefetch requests, measured on this blog, and how partialPrefetching shares one App Shell per route instead.

Nov 3, 20264 min read

One Line in My Root Layout Turned 158 Static Pages Into 0

Reading a cookie with cookies() in the Next.js root layout opts every route out of static rendering. What it cost this blog, measured, and how to fix a theme flash without it.

Nov 1, 20267 min read3

I Optimized a Button From O(n) to O(1). The Speed Didn't Matter.

A bug report, a route map, and three rounds of making it faster — a story about what Big O really measures, why constants win at small n, and why the best algorithm is sometimes deleting the question.

Oct 31, 202610 min read6

Get new posts in your inbox

No spam. Unsubscribe any time.

2 min left
Discuss👍 React
👍