Skip to main content

Server Rendering visual mental model

Server rendering lets React produce HTML before the browser has finished booting the interactive client application.

SSR → browser → hydration
ServerReact renders HTML

The server produces markup for the initial request.

BrowserHTML becomes visible

Users may see meaningful content before client JavaScript finishes loading.

HydrationReact attaches to existing markup

The client tree must match the server output closely enough for React to adopt the existing DOM.

ClientReact handles updates normally

State, events, Effects, and later renders continue from the hydrated tree.

Hydration is adoption, not a second unrelated render​

Hydration contract
Server and client agree

Equivalent initial output lets React attach event behaviour and preserve the existing DOM efficiently.

Server and client disagree

Time-dependent values, browser-only branches, random output, or mismatched data can create hydration warnings or replacement work.

Streaming changes when HTML arrives​

1Request arrives
2Shell can render
3HTML begins streaming
4Suspended regions resolve
5More HTML streams
Streaming + Suspense architecture
Stable shell renders first
Fast Suspense region

Reveals as soon as its server work is ready.

Slow Suspense region

Does not have to block the entire response.

SSR, static rendering, and client rendering solve different timing problems​

Rendering strategy map
Request timeServer rendering

Produce HTML for the request using server-side rendering APIs or a framework.

Build / pre-render timeStatic rendering

Produce reusable HTML ahead of requests when the content model allows it.

BrowserClient rendering

Build the visible UI after JavaScript runs in the browser.

Choose based on ownership and timing​

What rendering requirement do you have?
Meaningful HTML should arrive with the requestUse SSR or framework server rendering.
Content can be produced ahead of timeStatic/prerendered output may fit.
Slow regions should not block the whole responseUse streaming with meaningful Suspense boundaries.
Initial server and client output differ intentionallyRedesign the boundary instead of accepting hydration mismatch as normal.
The app is purely browser-only and server HTML adds little valueClient rendering may be sufficient.

Keep this mental model​

Server rendering in one picture
Server creates initial HTML
Hydration connects client React to that HTML
Client React owns later interaction and updates

Continue with Hydration and hydrateRoot for the detailed APIs, mismatch debugging, and production patterns.