CSR vs SSR vs SSG (and ISR)
MediumRenderingSSRSSG
What's the difference between CSR, SSR, SSG and ISR, and how do you choose?
TL;DR
They differ in where and when HTML is produced. CSR (client-side rendering) sends an empty shell and builds the page with JavaScript in the browser. SSR (server-side rendering) builds HTML on the server per request. SSG (static site generation) builds HTML once at build time and serves it from a CDN. ISR (incremental static regeneration) is SSG that regenerates pages in the background after a set time or on demand. Choose by how fresh and personalized the content is, and how much SEO and first-load speed matter.
Key points
| Content freshness | First load / SEO | Server cost | |
|---|---|---|---|
| CSR | Live | Slow first paint, weaker SEO | Lowest |
| SSR | Per request | Fast paint, good SEO | Highest |
| SSG | As of last build | Fastest (CDN) | Very low |
| ISR | Within the revalidate window | Fastest (CDN) | Low |
- SSR and SSG pages still need hydration to become interactive, so heavy JavaScript can delay interactivity (INP).
- Streaming SSR sends HTML in chunks with
<Suspense>, so slow data doesn't block the whole page. - Modern frameworks mix strategies per route: a static marketing page, an SSR product page, a CSR dashboard behind login.
Example
- Blog or docs: SSG.
- E-commerce product page: ISR (prices change, but not every second) or SSR with caching.
- Search results or personalized feed: SSR.
- Admin dashboard behind auth: CSR is fine; SEO doesn't matter.
Common follow-ups
- What's a hydration mismatch? The client's first render differs from the server HTML, for example from
Date.now()or readingwindowduring render. - Where do React Server Components fit? They're orthogonal: they decide which components ship JavaScript, and work with SSR or SSG.
What interviewers look for
Tip
Pick a strategy per page from concrete requirements (freshness, personalization, SEO) instead of one for the whole app.
- Red flag: "SSR is always better", ignoring server cost and time to first byte.