FlashcardNot attempted
Where the HTML comes from
Recall it before you reveal
For a request to /products/42, where is the HTML produced in a pure SPA, with SSR, and with SSG (prerendering)?
Space to reveal
Show answer & explanation
- Pure SPA: nowhere. Every URL gets the same near-empty
index.html(<div id="root"></div>plus a script); JavaScript builds the page in the browser. - SSR: a server runs the app on each request and returns full HTML. Needs a running server; can use per-request data (cookies, the database).
- SSG / prerender: the app is run once at build time for every known URL and the HTML is saved as files (
dist/products/42/index.html). Any static host or CDN serves them; no code runs per request, so the HTML is the same for everyone until the next build.
SSR and SSG look the same to the browser: full HTML first, then JavaScript that hydrates it.