How does Next.js handle partial prerendering (PPR)?

Partial Prerendering serves every route as a prerendered static shell, containing static content, cached content and <Suspense> fallbacks, and streams the dynamic parts into it in the same response. In Next.js 16 it is not a separate flag: it is the default behavior when cacheComponents: true is enabled, replacing the experimental ppr option from Next.js 14 and 15.

How it works

  1. At build, Next.js renders each route until it reaches request-time work (cookies, headers, searchParams, uncached I/O, connection()).
  2. Everything rendered so far, plus the nearest <Suspense> fallbacks, becomes the static shell (HTML and RSC payload), served instantly from a CDN.
  3. At request time, the server renders only the dynamic holes and streams them into the shell over the same HTTP response.
  4. "use cache" content is part of the shell as long as its lifetime is not too short.

Requirements Next.js enforces

Request-time work must be inside <Suspense> or cached; otherwise the dev overlay and build report a "blocking route" with suggested fixes. Random values and timestamps need either "use cache" or connection()/io().

History

  • 14: experimental ppr flag.
  • 15: experimental.ppr: 'incremental' with export const experimental_ppr = true per route.
  • 16: flag and route export removed. Enable cacheComponents instead. The model differs from the 15 canaries.
  • 16.3/16.4: Partial Prefetching (partialPrefetching: true) prefetches App Shells, and ensureStatic can require parts of a route to stay static.

Benefits

Static-site speed for the first bytes, dynamic personalization where needed, and no all-or-nothing choice per route.

Caveat

Some bots cannot handle streamed metadata. Next.js detects them (htmlLimitedBots) and renders the full page for them.

Code example

tsx
1// next.config.ts
2// const nextConfig = { cacheComponents: true, partialPrefetching: true };
3
4// app/product/[id]/page.tsx
5import { Suspense } from "react";
6import { cookies } from "next/headers";
7import { cacheLife } from "next/cache";
8
9async function Product({ id }: { id: string }) {
10 "use cache";
11 cacheLife("hours");
12 const p = await fetch(`https://api.example.com/p/${id}`).then((r) => r.json());
13 return <h1>{p.name}</h1>; // static shell
14}
15
16async function Cart() {
17 const cart = (await cookies()).get("cart")?.value; // dynamic hole
18 return <p>Cart: {cart ? JSON.parse(cart).length : 0} items</p>;
19}
20
21export default async function Page({ params }: PageProps<"/product/[id]">) {
22 const { id } = await params;
23 return (
24 <>
25 <header>Acme Store</header> {/* static shell */}
26 <Product id={id} /> {/* static shell (cached) */}
27 <Suspense fallback={<p>Cart: …</p>}> {/* fallback in shell */}
28 <Cart /> {/* streamed per request */}
29 </Suspense>
30 </>
31 );
32}

Practice this question

Open it in the study app to track progress, take notes, listen to the answer and work through the rest of the Next.js set.

Open in study app