search

Home  >  Q&A  >  body text

What is the difference between React Server Components (RSC) and Server Side Rendering (SSR)?

With the emergence of React 18, RSC was born. I'm wondering how it differs from SSR in NextJS.

P粉588152636P粉588152636303 days ago633

reply all(1)I'll reply

  • P粉378890106

    P粉3788901062024-01-17 00:26:20

    In both cases, the React Javascript code is executed by Node.js (or Deno, or whatever you are using). But they produce different things.

    Server side rendering

    Server-side rendering refers to React using ReactDom's ReactDom's < code>renderToString() method and sending the HTML string to the client, which is different from sending static HTML Same for any server.

    Then, typically via an SSR setup, React is re-run on the client side, running on the same rendered HTML and doing things like connecting click handlers and adding interactivity. This requires that the server and client have the same data to render. This is done by serializing the data on the server into