SSR and Static Site Generation (SSG) shift page rendering from the client to the server, allowing users to receive pre-rendered HTML immediately. This approach significantly enhances loading speed, user experience, and search engine visibility.
Rendering Strategy Comparison
Client-Side Rendering (CSR)
The browser first downloads JavaScript files
JavaScript runs and generates the UI in the browser
Users see content only after rendering completes
Estimated load time: around 2β4 seconds
Server-Side Rendering (SSR)
The server generates complete HTML before sending it
The browser can display content right away
JavaScript then adds interactive functionality through hydration
Estimated load time: around 0.5β1.5 seconds
Static Site Generation (SSG)
Pages are generated as static HTML during the build process
Content is delivered instantly through a CDN
JavaScript hydrates the page to enable interactions
Estimated load time: around 0.2β0.8 seconds
Next.js SSR Implementation
//β¦