The Four Rendering Strategies

StrategyWhen HTML is generatedFirst load speedSEOServer load
CSRIn browser (runtime)SlowPoorLow (static files)
SSROn server (per request)FastExcellentHigh (per request)
SSGAt build timeFastestExcellentMinimal (static files)
ISRBuild + periodic rebuildFastestExcellentLow (occasional rebuild)

CSR — Client-Side Rendering

In CSR (the traditional React SPA approach), the server sends a minimal HTML file containing just a <div id="root"></div> and a large JavaScript bundle. The browser downloads the JS, executes it, and React renders the UI.

CSR request flow 1. Browser requests /products 2. Server sends: <html><body><div id="root"></div><script src="app.js"></script></body></html> 3. Browser downloads app.js (300KB+ bundle) 4. Browser executes JavaScript 5. React fetches data from API (/api/products) 6. React renders product list 7. User sees content [total: 2-5 seconds on slow connections]

Pros: Rich interactivity, fast subsequent navigation (SPA), server just serves static files (cheap hosting), great for authenticated/personalised dashboards.

Cons: Slow initial load (must download + execute JS before anything shows), poor SEO (crawlers see empty HTML), poor performance on low-end devices.

SSR — Server-Side Rendering

With SSR, the server renders the full HTML page on each incoming request. The client receives fully populated HTML — visible immediately — and then JavaScript "hydrates" it to make it interactive.

SSR request flow 1. Browser requests /products 2. Server: fetches product data from DB, renders React components to HTML 3. Server sends: fully rendered HTML with product list 4. Browser displays HTML immediately [user sees content] 5. Browser downloads JS bundle 6. React hydrates the HTML (attaches event handlers) 7. Page becomes interactive [total to first content: 200-500ms]

Pros: Fast first contentful paint, excellent SEO, works without JavaScript (progressive enhancement), fresh data on every request.

Cons: Server must process every request (higher infrastructure cost), cannot serve from CDN edge (traditionally), Time To Interactive can be slow if JS bundle is large (hydration cost).

SSG — Static Site Generation

SSG pre-builds all HTML pages at deploy time. Pages are plain HTML files stored on a CDN. No server-side computation occurs at request time — the CDN just serves the file. This is the fastest possible delivery.

SSG build + request flow Build time (runs once): - Framework fetches all products from CMS/DB - Renders HTML for /products, /products/iphone, /products/macbook - Outputs static .html files Runtime (per request): 1. Browser requests /products 2. CDN serves pre-built products.html 3. User sees content [total: 50-200ms — just network latency] 4. JS hydrates for interactivity No server computation. No database queries at request time.

Pros: Fastest possible delivery, infinitely cacheable on CDN, lowest server costs (often free), excellent SEO.

Cons: Build time grows with number of pages (10,000 pages = long build), content staleness (rebuild required to update), not suitable for personalised or user-specific content.

ISR — Incremental Static Regeneration

ISR (a Next.js innovation) combines SSG performance with the ability to update content without full rebuilds. Each page has a revalidate time — it serves statically until that period expires, then regenerates in the background.

Next.js ISR — App Router example // app/products/[id]/page.tsx export const revalidate = 60; // seconds — regenerate every minute export default async function ProductPage({ params }) { const product = await fetchProduct(params.id); // fetched at build/revalidation return <ProductDetail product={product} />; } // Pages Router equivalent: export async function getStaticProps({ params }) { const product = await fetchProduct(params.id); return { props: { product }, revalidate: 60, // regenerate after 60 seconds }; }

How ISR works: The page is built statically and served instantly. After 60 seconds, the next visitor triggers a background rebuild while still receiving the current (stale) page. Subsequent visitors get the fresh page. No user ever waits for a build.

Hydration — The Bridge Between SSR/SSG and Interactivity

When SSR or SSG pre-renders HTML, the user sees content immediately. But the page is not yet interactive — buttons do nothing, forms do not submit. Hydration is the process of React "taking over" the pre-rendered HTML by attaching event listeners and making it reactive.

Hydration process Phase 1: HTML received from server/CDN - Page is visible but static - Buttons exist but have no onClick handlers Phase 2: JavaScript bundle downloads and executes - React walks the component tree - Matches React's virtual DOM to the existing HTML - Attaches event handlers Phase 3: Hydration complete — page is interactive Problem: hydration can be slow for large pages Solution: Partial hydration (only hydrate interactive components) Resumability (Qwik) — skip full hydration entirely

Hydration Mismatch Errors

If the HTML rendered on the server differs from what React renders on the client, you get a "hydration mismatch" error. Common causes: using Math.random() or Date.now() in render, browser-only APIs (localStorage, window) accessed during render, different data on server and client. Always ensure server and client render the same initial output.

Next.js — Mixing Strategies Per Page

Next.js lets different pages in the same application use different rendering strategies. This is the key advantage of meta-frameworks:

Next.js — per-page rendering strategies app/ page.tsx → SSR or RSC (server-rendered home page) about/page.tsx → SSG (static, rarely changes) blog/[slug]/page.tsx → ISR (revalidate: 3600) dashboard/page.tsx → CSR (authenticated, private) products/page.tsx → ISR (revalidate: 60 — product data changes) search/page.tsx → SSR (query-dependent, personalised)

React Server Components — Blurring the Line

React Server Components (RSC), default in Next.js App Router, run only on the server. They can access databases directly without an API layer, have zero JavaScript bundle cost (they don't ship JS to the browser), and compose with Client Components for interactivity. RSC effectively makes every component able to be server-side rendered, blurring the CSR/SSR distinction at the component level.

How We Research and Update This Guide

We test the underlying formula or workflow, compare outputs with reliable references, and revise examples whenever the page content changes.

  • The workflow or formula is tested directly in the tool and compared against independent reference examples.
  • Examples are kept practical so readers can verify the result without hidden assumptions.
  • Pages are revised whenever the interface, calculation flow, or surrounding guidance materially changes.

Frequently Asked Questions — CSR vs SSR vs SSG