In React applications', HTML is first rendered by the server and sent to the client via server-side rendering (SSR). In contrast, client-side rendering (CSR) receives a simple HTML page and renders it using JavaScript.
 

Life Cycle

  • Once a user requests a page, the server processes it.
  • Server-side rendering: React renders components into HTML.
  • HTML to client: The server transmits fully rendered HTML to the client.
  • Hydration: After loading HTML, React attaches event handlers to make the page interactive.
     

 

Server-side rendering benefits

  • Faster start load:  The server transmits completely rendered HTML, so users see the content faster than with CSR, where the browser must download and execute JavaScript.
  • Better SEO: Search engines may simply index fully displayed HTML, increasing application SEO. This is crucial for content-heavy sites.
  • Performance on slower devices: SSR minimises client-side JavaScript processing, which benefits users with slower devices or poor network conditions.
  • Better user experience
  • Performance: Even with JavaScript loading in the background, users view content sooner, making the app seem speedier.
     

Related Question