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
- At build, Next.js renders each route until it reaches request-time work (cookies, headers,
searchParams, uncached I/O,connection()). - Everything rendered so far, plus the nearest
<Suspense>fallbacks, becomes the static shell (HTML and RSC payload), served instantly from a CDN. - At request time, the server renders only the dynamic holes and streams them into the shell over the same HTTP response.
"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
pprflag. - 15:
experimental.ppr: 'incremental'withexport const experimental_ppr = trueper route. - 16: flag and route export removed. Enable
cacheComponentsinstead. The model differs from the 15 canaries. - 16.3/16.4: Partial Prefetching (
partialPrefetching: true) prefetches App Shells, andensureStaticcan 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
1// next.config.ts2// const nextConfig = { cacheComponents: true, partialPrefetching: true };34// app/product/[id]/page.tsx5import { Suspense } from "react";6import { cookies } from "next/headers";7import { cacheLife } from "next/cache";89async 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 shell14}1516async function Cart() {17 const cart = (await cookies()).get("cart")?.value; // dynamic hole18 return <p>Cart: {cart ? JSON.parse(cart).length : 0} items</p>;19}2021export 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.