Skip to main content
17

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 freshnessFirst load / SEOServer cost
CSRLiveSlow first paint, weaker SEOLowest
SSRPer requestFast paint, good SEOHighest
SSGAs of last buildFastest (CDN)Very low
ISRWithin the revalidate windowFastest (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 reading window during 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.

Was this helpful?

Related questions