What rendering strategies exist? Tell me about CSR, SSR, SSG.
sobes.tech AI
Answer from AI
There are three main rendering strategies in web development:
-
CSR (Client-Side Rendering) — rendering occurs in the browser using JavaScript. The server sends minimal HTML and scripts, which dynamically create the page content. Example: React SPA. Pros — high interactivity, cons — slow initial render and SEO issues.
-
SSR (Server-Side Rendering) — the server generates the complete HTML of the page and sends it to the client. This improves SEO and initial load time. After the page loads, client-side JS can 'hydrate' the page for interactivity.
-
SSG (Static Site Generation) — pages are pre-generated at build time. This is a fast and reliable method, as the server delivers a ready static HTML. Used in blogs, documentation, where content rarely changes.
Each strategy has its advantages and is chosen based on the project requirements.