Today I Learned

Client-Side Rendering vs Server-Side Rendering vs Static Site Generation

April 5, 2021

Client-side Rendering (CSR)

The concept of CSR is the browser (client) renders the page dynamically using JavaScript, each route and page content is created and rendered by the browser.

The server takes care of receiving the page requests and sending back the basic HTML and JavaScript, then, the browser will execute the JS to render the content.

Pros

Cons

Server-side Rendering (SSR)

The initial request of an SSR application will load the HTML pages, CSS, JavaScript all with their contents fully ready to be rendered.

All pages in SSR are static, so each page will have its own html and not depend on JavaScript to render it. Next.js is a popular React framework that supports SSR.

Pros

Cons

Static Site Generation (SSG)

SSG sites are using templates to create HTML pages to be ready to view at anytime a client requests. Unlike SSR, it creates these pages ahead of time, not on-demand, which speeds up page loading time.

Pros

Cons

Reference

https://lo-victoria.com/comparing-3-ways-websites-render-onto-browser

← All posts