Next.js · Junior · Question 23 of 75
How does SSR differ from SSG?
- ✓Correct answer: SSR - HTML on every request, SSG - ahead of time at build
- 2SSR renders in the user's browser, while SSG renders on the server
- 3SSG requires a database connection, while SSR works without one
Explanation
Static Site Generation (prerendering) creates HTML at build time and serves it from a CDN - fast and cheap, but the data is "frozen". Server-Side Rendering produces HTML on every request - the data is fresh and personalized, but load and TTFB are higher. Rendering in the browser is CSR.