How it works
The explanation, with examples you can run.
The options
Client-side rendering (CSR). The server returns a shell and a script bundle; the script fetches data and builds the DOM. Hosting is trivial and navigation inside the app can be quick, but nothing useful appears until the bundle has downloaded and run, which hurts LCP on slow phones and networks. Good for tools behind a login where search engines don't matter.
Server-side rendering (SSR). The server runs the same components for each request and sends real HTML. Content appears in the first response and can be personalised, but every request costs server time, and the time to first byte includes your slowest data fetch unless you stream.
Static generation (SSG, prerendering). Pages are rendered at build time and served as files, ideally from a CDN. It is the fastest and cheapest to serve, but the content is the same for every visitor and only as fresh as the last build. Many frameworks add regeneration: rebuild a page in the background after a time limit or when content changes, which brings static pages close to SSR's freshness.
Streaming. The server sends the document in chunks: the head and page shell first, then each section as its data arrives. The browser starts parsing, fetching CSS and painting from the first chunk. A slow recommendations panel no longer delays the whole page.
Hydration
Server-rendered or static HTML is visible but not yet interactive. Hydration runs the components again in the browser so they can attach event handlers and take over. Until it finishes, clicks may do nothing, and the work itself is a long task that can hurt INP. Ways to do less of it:
- Partial or island hydration: only the interactive parts (a cart button, a search box) ship and run JavaScript; the rest stays plain HTML.
- Server components: some frameworks render parts only on the server and send no JavaScript for them at all.
- Progressive enhancement: make forms and links work as plain HTML, so the page is usable before any script runs.
Choosing
- Same for everyone, changes rarely: static, served from a CDN, with regeneration on change.
- Personal or changes every request, and first paint matters: SSR, streamed.
- An app behind a login with heavy interaction: CSR is acceptable, but keep the shell fast.
- Most real sites mix them: a static marketing page, a server-rendered product page, a client-rendered dashboard.
Whatever you choose, cache what you can (static output and shared SSR responses at a CDN), and measure the result with field data rather than assuming one strategy is fast.
Check yourself
3 questions. Get them all right to finish this topic.
0 of 3 right so far. Get all three to finish this topic.