Everything in this guide so far has run in the browser. Even the server state chapter, with TanStack Query caching books for you, started from the same place: the browser downloads your JavaScript, React renders, and only then does anyone ask the server for data. That's one way to build a page. It isn't the only one, and for many pages it isn't the best one.
This is an overview chapter. It lays out every rendering strategy you'll be asked about (client rendering, server rendering, static generation, incremental regeneration, streaming, partial prerendering and Server Components), what each one does per request, and what it gains and loses. The next three chapters go deep: SSR and hydration makes the server half runnable, Server Components explains the newer model, and Server Functions covers the trip back. The Next.js forms of all this come in Part 8.
The problem: the browser starts with nothing#
Here's the reading list, rendered two ways. The first string is what a client-rendered app's server sends for every URL. The second is what a server-rendered app sends after fetching the books and rendering them. Run it and compare what a user (or a search crawler) has before a single line of your JavaScript runs.
import { renderToString } from "react-dom/server";
import { fakeFetch } from "guide-tools";
function ReadingList({ books }: { books: { id: number; title: string }[] }) {
return (
<ul>
{books.slice(0, 3).map((b) => (
<li key={b.id}>{b.title}</li>
))}
</ul>
);
}
// Client-side rendering: the same file for every URL, served from a CDN.
const csrResponse = `<body><div id="root"></div><script src="/app.js"></script></body>`;
// Server-side rendering: fetch first, render to HTML, then respond.
const t0 = performance.now();
const books = await fakeFetch("/books");
const html = renderToString(<ReadingList books={books} />);
const ssrResponse = `<body><div id="root">${html}</div><script src="/app.js"></script></body>`;
const t1 = performance.now();
console.log("CSR response (instant):\n" + csrResponse);
console.log(`SSR response (after ${Math.round(t1 - t0)} ms of server work):\n` + ssrResponse);The CSR response is instant and useless: an empty div. The user stares at a blank page (or a spinner) while app.js downloads, parses, runs, and then starts the same fetch. The SSR response has the content, but the server had to do 400 ms of work before sending a single byte.
That trade, who does the work and when, is the whole chapter. Every strategy below is a different answer to three questions: where does rendering happen (browser or server), when does it happen (at build time, per request, or in the background), and how much JavaScript has to run before the page responds to input?
Four timestamps that frame every answer#
You can't compare strategies without a vocabulary for "fast". These are the ones interviewers expect:
- TTFB (time to first byte): from the request until the first byte of the response arrives. Server work, network distance and caching decide it.
- FCP (first contentful paint): the first time the browser paints any text or image. A spinner counts.
- LCP (largest contentful paint): when the biggest piece of content in the viewport (the hero image, the main heading, the list) is painted. It's one of Google's three Core Web Vitals, along with INP and CLS, so it affects search ranking.
- Interactive: when clicks and typing actually do something. In a React app that means the component code has loaded and hydration (attaching React to server HTML, the subject of the next chapter) has finished for that part of the page. The metric that measures the felt result is INP (interaction to next paint): how long the page takes to respond visually to input.
Two more costs don't show up in a lab timing but decide architecture: server cost (how much compute each request burns) and freshness (how old the content can be when a user sees it).
The strategies, one by one#
Read each section with the timeline below open. Switch tabs and watch which bars move.
Client-side rendering. The server sends an empty <div id="root"> and a script. Nothing meaningful appears until the JavaScript downloads, runs and then fetches data. Cheap to host, slow first view, poor for crawlers that don't run JS.
Client-side rendering (CSR)#
Per request: a CDN returns the same tiny HTML file and a JavaScript bundle. The browser downloads and runs the bundle, React renders, effects or a query library fetch data, React renders again with it.
Gains: trivial, cheap hosting (static files), fast TTFB, and once loaded, navigation between pages never waits for the server to render HTML. Rich, app-like screens (an editor, a dashboard behind a login) work well this way.
Loses: FCP and LCP wait for the whole bundle plus a data round trip that only starts after the bundle runs (the "waterfall"). Crawlers that don't run JavaScript see nothing, and the ones that do (Google's does) index later. Every byte of every component ships to every user.
This is what a Vite single-page app gives you out of the box, and what Create React App gave you before it was deprecated.
Server-side rendering (SSR)#
Per request: the server fetches the data, renders the React tree to an HTML string, and sends it with the same JavaScript bundle. The browser paints the HTML immediately, then downloads the JS and hydrates: React renders the same tree in the browser and attaches event handlers to the existing DOM instead of creating new nodes.
Gains: FCP and LCP arrive with the HTML. Crawlers see real content. Data is fetched next to the database instead of across the user's network.
Loses: TTFB includes the slowest query on the page, because classic SSR is all or nothing: renderToString can't wait for data, so the server fetches everything first and then renders the whole page in one go. Every request costs server CPU. And there's an awkward gap: the page looks ready before it is ready. Buttons rendered on the server do nothing until hydration finishes. People call this the uncanny valley, and on slow phones it can last seconds.
The bundle doesn't shrink either. SSR adds HTML; it removes no JavaScript.
Static site generation (SSG)#
Per request: nothing renders. The HTML was produced at build time by running the same server render once per page, and a CDN serves the file. Hydration still happens in the browser.
Gains: the best TTFB you can get (a file from a nearby edge server), near-zero server cost, and pages that survive a database outage.
Loses: freshness and personalization. The page is exactly as current as the last build. Content that depends on the user, a cookie or the current time can't be in the HTML. Sites with millions of pages also pay at build time.
Docs, blogs and marketing pages are the classic fit. This site is mostly that.
Incremental static regeneration (ISR)#
Per request: like SSG, the CDN serves a cached HTML page. Each page has an expiry (say 60 seconds). After it passes, the next request still gets the stale page instantly, and that request triggers a regeneration in the background. Once it finishes, the cache is replaced and later visitors get the new version. Pages that were never built can be rendered on first request and cached from then on.
This is the HTTP pattern called stale-while-revalidate, applied to whole pages. ISR is a Next.js term (in the App Router today it's expressed through cache lifetimes; see Caching in Next.js), but the idea works anywhere you control a cache.
Gains: static speed with bounded staleness, and builds that don't have to render every page up front.
Loses: someone always sees the stale version once. It still can't personalize. And "how stale can this be?" becomes a product decision you have to make per page, plus on-demand invalidation when content changes (a CMS webhook calling a revalidate function).
Streaming SSR#
Classic SSR's problem is all or nothing: one slow query holds the whole response hostage. Streaming fixes it with the tool you met in Suspense and use.
Per request: the server renders until it hits a <Suspense> boundary whose content isn't ready. Instead of waiting, it sends the shell right away (everything outside the pending boundaries, with each boundary's fallback in place) and keeps the HTTP response open. When a boundary's data resolves, React renders it and streams an extra chunk down the same response: the finished HTML plus a tiny inline script that swaps it in for the fallback.
Gains: TTFB and FCP no longer depend on the slowest query. You decide, with Suspense boundaries, which content is worth waiting for (put it in the shell) and which can pop in. The shell can hydrate and respond to clicks before the slow parts have even arrived.
Loses: server cost stays per request, and connections stay open longer. Layout can shift if fallbacks aren't the same size as the content. Status codes and headers are sent with the shell, so an error discovered later can't become a 404 or 500; the stream has to render an error state instead.
This is what renderToReadableStream and renderToPipeableStream do. You'll read the chunks yourself in the next chapter.
Partial prerendering (PPR)#
Look at most real pages: a product page is mostly static (layout, description, images) with a few holes that depend on the request (the cart count, "recommended for you", stock for your region). SSG can't do the holes and SSR re-renders the whole page for them.
Per request: the static parts were prerendered ahead of time into a shell, with Suspense fallbacks where the dynamic parts go. The shell is served instantly from a cache, and in the same response the server renders only the dynamic holes and streams them in.
React has the primitives. prerender from react-dom/static (in React since 19.0) can be aborted partway, and since 19.2 it then returns the static shell plus an opaque postponed state describing what's left. resume from react-dom/server (also added in 19.2) picks up from that state at request time. In Next.js 16 this is how Cache Components work: everything that can be static is static, and dynamic work is marked by Suspense boundaries and request APIs. Caching in Next.js and Rendering and deploying Next.js cover the framework side.
Gains: SSG-like TTFB and FCP on pages that are still personalized.
Loses: you need infrastructure that can serve a cached shell and keep streaming from a server in one response, plus a clear mental model of what's static and what isn't. Accidentally reading a cookie high in the tree makes the whole subtree dynamic.
React Server Components (RSC)#
Everything above is about when HTML is produced. Server Components change something else: which components ship JavaScript at all.
With SSR, every component renders twice: once on the server for HTML, and again in the browser to hydrate, which means its code has to be in the bundle. A Server Component runs only on the server (at build time or per request). Its output, a description of the UI, is sent to the browser, but its code, its dependencies and its data fetching never are. Only components marked as client components (with "use client") ship and hydrate.
Gains: less JavaScript to download and hydrate, so the page becomes interactive sooner and INP improves. Data access happens directly in components, next to the database, without an API layer just for the UI.
Loses: a new boundary to reason about (what can cross from server to client), a framework requirement (you need a bundler and server that understand the module split), and new security surface, which Server Functions covers.
The point people get wrong in interviews: Server Components aren't an alternative to SSR. They're orthogonal. In Next.js they run alongside streaming SSR: the server renders Server Components, then renders the result plus client components to HTML, and streams both. You could also use Server Components with no HTML at all (the client fetches the RSC payload and renders it). The Server Components chapter builds a toy version of the payload so you can see it.
The comparison in one table#
| Strategy | Rendered | TTFB | FCP / LCP | JS shipped | Server cost per request | Freshness | Personalized |
|---|---|---|---|---|---|---|---|
| CSR | Browser, every visit | Fastest | Late (after JS + fetch) | All | None | Live | Yes |
| SSR | Server, every request | Slowest query | Early | All | High | Live | Yes |
| SSG | Server, at build | Fastest | Earliest | All | None | Last build | No |
| ISR | Server, at build and in background | Fastest | Earliest | All | Low | Bounded staleness | No |
| Streaming SSR | Server, every request | Fast (shell) | Shell early, rest streams | All | High | Live | Yes |
| PPR | Shell at build, holes per request | Fastest | Shell earliest | All | Holes only | Live holes | Holes only |
| RSC | Server (build or request) | Depends on pairing | Depends on pairing | Client components only | Depends | Depends | Yes |
The RSC row says "depends" because it combines with the others: you can prerender Server Components statically, render them per request, or stream them.
Islands and resumability: two answers outside React#
React's answer to "too much JavaScript" is Server Components. Two other frameworks attack hydration cost from different angles, and senior interviews like the comparison.
Islands (Astro). The page is static HTML by default and ships zero JavaScript. You mark individual interactive components, the islands, and choose when each one loads and hydrates with a directive such as client:load, client:idle or client:visible. Each island hydrates independently. It's excellent for content sites with a few widgets. The cost: islands are separate roots, so sharing state between them needs something outside the component tree (a store or custom events), and highly interactive apps end up as one giant island.
Resumability (Qwik). Qwik skips hydration entirely. The server serializes the application state and the location of every event handler into the HTML. The browser runs almost nothing on load; when you click, a tiny global loader fetches just that handler's code and runs it, resuming where the server left off. Interactivity cost is paid per interaction instead of up front. The costs: a different programming model (code is split at boundaries marked with $), and the first interaction on a slow network has to fetch code before it can respond.
How they compare to RSC:
- Islands and RSC both mean "only interactive parts ship code". The difference is granularity and nesting: RSC lets server and client components interleave freely in one React tree (a client component can receive server-rendered children), and client components share context and state like any React app.
- React still hydrates the client components it ships. Qwik doesn't hydrate at all. React's mitigations are smaller bundles (RSC) and hydrating in pieces (selective hydration with Suspense, next chapter).
How to choose#
You rarely pick one strategy per app. You pick per route, and frameworks let you mix:
- Marketing, docs, blog: SSG, or ISR if a CMS edits it. Server Components to keep the JS small.
- Product or listing pages with a few personal bits: PPR, or static plus client-fetched holes.
- Per-user pages that must be fresh (an inbox, an order status): streaming SSR with Suspense around slow parts.
- An app behind a login where SEO doesn't matter (an editor, an admin tool): CSR is fine and often simplest. Server rendering still helps first load, but it's an optimization, not a requirement.
A good interview answer names the metric you're optimizing, the constraint (freshness, personalization, SEO, cost) and then the strategy, in that order.
Pitfalls#
Check your understanding#
Implement createIsrCache in lib.js. It takes { revalidate, render, now }: a window in seconds, an async render(key) that produces HTML, and a clock function. get(key) must:
- On the first request for a key, await
render, store the result and return{ html, status: "MISS" }. - Within the window, return the cached HTML with
status: "HIT"without rendering. - After the window, return the old HTML immediately with
status: "STALE"and start one background regeneration. Concurrent stale requests must not start a second one. When it finishes, later requests get the new HTML.
The starter handles the first two cases and gets the third one wrong: it blocks on a fresh render, which is SSR, not ISR.
export function createIsrCache({ revalidate, render, now = () => Date.now() }) {
const entries = new Map(); // key -> { html, at }
return {
async get(key) {
const entry = entries.get(key);
if (!entry) {
const html = await render(key);
entries.set(key, { html, at: now() });
return { html, status: "MISS" };
}
if (now() - entry.at < revalidate * 1000) {
return { html: entry.html, status: "HIT" };
}
// TODO: serve the stale page now and regenerate in the background.
const html = await render(key);
entries.set(key, { html, at: now() });
return { html, status: "MISS" };
},
};
}A logged-in dashboard shows the user's name and plan instantly, and a slow analytics chart that takes 2 seconds to query. SEO doesn't matter, but first load should be fast. Which fits best?
A search crawler that doesn't run JavaScript requests three pages: a Vite single-page app's /books, a Next.js page that streams its book list inside a Suspense boundary, and an SSG blog post. What does it get from each?
An interviewer asks: "Explain the difference between SSR, SSG and ISR, and when you'd use each."
An interviewer asks: "If we already do SSR, what do Server Components add?"
Interview angle
Every rendering strategy answers three questions: where the HTML is produced, when, and how much JavaScript has to run before the page responds. CSR renders in the browser, so it's cheap but slow to first content. SSR renders per request on the server, so content shows early but every request pays and the page still hydrates everything. SSG and ISR serve prebuilt HTML from a cache, trading freshness and personalization for speed. Streaming SSR sends the shell first and streams Suspense boundaries later, PPR prerenders the static shell and renders only the dynamic holes, and Server Components cut the JavaScript that ships at all.
What are the trade-offs between client-side rendering and server-side rendering?
Explain SSR, SSG and ISR. When would you use each?
What problem does streaming SSR solve, and how does it work?
What is Partial Prerendering and how is it different from streaming SSR?
Are Server Components a replacement for SSR?
How do Astro's islands and Qwik's resumability compare with React's approach?
Recap#
- Every strategy answers three questions: where rendering happens, when it happens, and how much JavaScript must run before the page responds.
- CSR is cheap and app-like but slow to first content. SSR shows content early but pays per request and still hydrates everything. SSG and ISR serve cached HTML, trading freshness and personalization for speed.
- Streaming SSR sends the shell immediately and streams Suspense boundaries as their data resolves. PPR prerenders the static shell and renders only the dynamic holes per request (
prerenderplusresume, which React 19.2 added). - Server Components cut shipped JavaScript; they're orthogonal to SSR and usually run with it.
- Islands (Astro) and resumability (Qwik) attack hydration cost differently: hydrate only marked widgets, or never hydrate and load handlers on demand.
- Choose per route, starting from the metric and the constraint, not the technology.
Sources#
- react.dev: Server React DOM APIs, Static React DOM APIs,
resume, Server Components - react.dev blog: React 19.2 (partial prerendering APIs)
- web.dev: Web Vitals, Time to First Byte, Rendering on the Web
- nextjs.org: Cache Components
- Astro: Islands architecture
- Qwik: Resumable vs. hydration
- Facts checked November 24, 2026.