Middle
SSG is generated during build, SSR — during request. When would you use each? What is ISR?
sobes.tech AI
Answer from AI
SSG (Static Site Generation) generates HTML pages at build time. This is good for content that rarely changes, such as blogs or documentation, because pages load quickly and are easily cached.
SSR (Server-Side Rendering) renders pages on the server for each request. This is useful for dynamic content that depends on the user or updates frequently.
ISR (Incremental Static Regeneration) is a hybrid approach that allows updating static pages after build without rebuilding the entire site. For example, you can set a refresh period for a page, and after this period, the page will be rebuilt on the server upon the first request and used for subsequent requests.
When to use:
- SSG: static content, high performance, and SEO.
- SSR: dynamic content, personalization.
- ISR: when a balance between static and dynamic content is needed, such as news or products with frequent updates.