Quick answer
A single-page application (SPA) is a web app that loads one HTML page and updates it with JavaScript as the user navigates. Gmail and Twitter are SPAs.
What it is
An SPA loads a single HTML shell and uses JavaScript to render views client-side. Navigation feels instant because the page never reloads. The trade-off is a heavier initial load and weaker SEO unless you add server rendering.
Why it matters
SPAs feel like native apps. They are great for dashboards and tools. For marketing sites, a server-rendered framework like Next.js or Remix is usually a better fit.
How to use it
- Use an SPA when most interaction happens after the first load.
- Add server rendering for the first paint and SEO.
- Use a router that supports deep linking and history.
- Be careful with memory leaks and bundle size.
Examples
- Gmail and Twitter are SPAs.
- A SaaS dashboard is usually an SPA, with marketing pages on a separate SSR framework.