--- { title: "What are React Server Components (RSCs)?", description: "React Server Components have been a topic of regular discussion in the WebDev space as-of late. What are they? How do they improve the SSR story for React? Let's take a look.", published: '2023-12-16T21:52:59.284Z', edited: '2023-12-17T21:52:59.284Z', authors: ['crutchcorn'], tags: ['react', 'webdev', 'javascript'], attached: [], license: 'cc-by-4', collection: "react-beyond-the-render", order: 4 } --- [In our last article in the series, we talked about how React is able to pre-generate HTML from JSX on the server (or developer's machine) prior to being shipped to the end-user](/posts/what-is-ssr-and-ssg). This process is called "SSR" and can be mission-critical in getting your applications as performant as possible. I originally wrote that article in early 2020. At this point in React's development lifecycle, there was an inherent problem to using SSR; it would lead to duplicate effort between the server and the client. See, up to that point Next.js and other React SSR solutions had one way of doings things: 1) Render [the VDOM](/posts/what-is-reconciliation-and-the-vdom) on the server 2) Generate HTML from the server's VDOM 3) Ship HTML and all of the React code to the client 4) Re-generate the VDOM from scratch on the client 5) Wipe away the old DOM and re-render all components from the new client's VDOM instance ![The developer ships SSR and framework code to the server, which produces HTML. This HTML/CSS is then sent to the user machine where it re-initializes on the client's browser](./ssr_slowdown.svg) This process is called "Hydration" and while it _worked_ the way it did before, it introduced a new performance problem. Hydration could be needlessly expensive if most of your content coming from the server was going to be static anyway. This was a huge problem that the React team had to solve. Later in the same year of my article (December 2020), they had the answer: [React Server Components](https://legacy.reactjs.org/blog/2020/12/21/data-fetching-with-react-server-components.html). # What is a React Server Component (RSC)? In short; React Server components allow you to designate which React components render on the server and which components re-initialize on the client. This is done using a special syntax in your components and allows for special server-only data loading patterns when implemented properly. For example, take the following: ```jsx function App() { return <> {/* Render parts on the client */}
{/* Render all of it on the client */} {/* Render all of it on the server */}