CSR and SPA were once badly confused

frontendspacsrssrrendering

I started programming in 2017, when Angular, React and Vue were the big three and SPA frameworks were in fashion. Or rather, those frameworks were all I knew; I had no idea about server-side rendering in things like ASP.NET. Only after I came across Next.js did I learn about SSR, and only because of SSR did I learn about its counterpart, CSR. Until then my impression was that SPA meant CSR, and that SSR had appeared to fix the problems of SPAs.

But SPA and CSR refer to two different things.

  • SPA (Single-Page Application) means that on navigation, JS in the browser updates the page instead of asking the server for a whole new HTML page.
  • CSR (Client-Side Rendering) means the first page's HTML is assembled by JS in the browser; the server only sends a nearly empty HTML file and the JS.

Apps generated by Angular CLI, Create React App and Vue CLI do both by default, so the two words are easy to treat as one thing.

How SPA and CSR came apart

Having the server produce an SPA's first page, which is SSR (Server-Side Rendering), goes back further than it seems. Rendr in 2012 let Backbone apps render on both the server and the client, and the React CHANGELOG shows React 0.4 in 2013 already had renderComponentToString to generate HTML on the server and send it to the browser. But developers had to write their own Node server that called such a function on each request and then let the browser take over navigation. As the Next.js announcement laid out, Next.js made SSR the default in 2016: every component in pages/ is server-rendered automatically, while navigation is still handled by JS in the browser. A site built with the Next.js Pages Router has a server-rendered first page, not CSR, yet it navigates exactly like an SPA, so it is still an SPA.

YearsWhat happenedSPA and CSR
2010–2014SPAs emerge: Backbone, Angular 1, EmberAll default to CSR, so in practice SPA means CSR
2014–2018React and Vue dominateMostly still SPA plus CSR, with server rendering wired up by hand; the two words become synonyms in everyday use
2016–2020Next.js, Nuxt, Gatsby make SSR and SSG (Static Site Generation) the defaultNavigation is still client-side, so still SPA, but the first page is no longer CSR
2023 onNext.js 13.4 makes the App Router stable, built on React Server Components; React 19 (December 2024) is the release that marks React Server Components stableWithin one page, some components run only on the server and some are sent to the browser; the CSR/SSR/SSG split no longer covers it

Every term carries the assumptions of the era it was coined in. "SPA" assumed CSR because that's the era it was born in. "SSR" implied "with hydration" because the React/Vue/Svelte tradition shaped how the word was used.

What an SPA does on navigation

A traditional MPA (Multi-Page Application) asks the server for a whole page on every navigation. After a link is clicked, the two approaches go through these steps in order:

Traditional MPASPA
1Browser sends a GET to the serverThe router (some JS) intercepts the click
2Server returns a whole HTML pageIf needed, fetch asks the server for data
3Browser unloads the current pageDOM is updated in place
4New page renders, JS runs from the starthistory.pushState changes the URL; the page was never unloaded

The user perceives "fast, no white flash, app-like". The server mostly receives requests for specific data, not whole pages as with an MPA.

This says nothing about how the first page got rendered. That's a separate question. Five ways to render a web page, and what the server and browser each do animates five approaches, showing for each whether the first page's HTML is assembled by the server or by the browser.

Navigation and first render are chosen separately

What to decideChoices
Navigation experienceSPA (in-page updates) vs MPA (full page reloads)
Initial render strategyCSR / SSR / SSG / RSC (React Server Components) / Islands

You choose one of each. Common combinations:

  • SPA + CSR: apps generated by Create React App (which React deprecated in February 2025), Vue CLI or Angular CLI by default, and React or Vue projects started with Vite today
  • SPA + SSR + hydration: Next.js Pages Router (for pages with getServerSideProps or getInitialProps, or when a custom _app has getInitialProps; with none of these, Next.js produces static HTML at build time), Remix, SvelteKit, Nuxt
  • SPA + SSG + hydration: Gatsby, Next.js static export (output: 'export', which is what this site uses)
  • SPA + RSC + hydration of client components only: Next.js App Router (stable since 13.4, 2023)
  • MPA + pure server-render: Django, Laravel with Blade, traditional PHP. New Rails 7+ apps ship with Turbo Drive by default, so their navigation works the way the Turbo Drive paragraph below describes, without full page reloads
  • MPA + Islands: Astro (default mode). Islands means most of the page is plain HTML produced on the server, and only the few components that need interaction are hydrated in the browser

The HTML from SSR or SSG is only the picture. HTML can carry a handler as a string, like onclick="...", but in React or Vue an event handler is a function inside the component that uses the component's state and props, and it can't be turned into such a string. So the browser downloads the components' JS, runs the components again, and attaches the handlers to the existing DOM, which is hydration. The framework's router arrives with that JS, and from then on the browser handles navigation.

SPA-style navigation is possible without hydration. Turbo Drive intercepts link clicks, fetches the next page's server-rendered HTML and swaps the <body> without a full reload. Astro's <ClientRouter /> also intercepts the click and swaps in the next page's fetched HTML.

References