What the Hell is RSC(React Server Components), Anyway?

Haseeb
3 min readApr 14, 2024

--

For developer like me ,the acronym RSC might as well stand for “Really Stumping Concept.” If you’re scratching your head wondering what the hell RSC is, you’re not alone. Let’s dive into this explaining concept and unravel its mysteries for those who might not be in the know.

Intro

In the ever-evolving landscape of web development, React Server Components (RSC) stand out as a paradigm-shifting concept that continues to intrigue and perplex developers. Despite its name, React Server Components are not an entirely new entity but rather a crucial component within the broader React architecture. In this article, we’ll delve deep into the core concepts of React Server Components, unraveling their significance and shedding light on their role in modern React development.

The big picture : React Architecture

To comprehend React Server Components, it’s essential to first grasp the overarching React architecture. React architecture encompasses two integral parts: React Server and React Client. These components form a symbiotic relationship, with React Server responding to requests from React Client. However, it’s vital to note that their classification as server or client stems from their request-response dynamics rather than their execution environments.

Understanding React Components

At the heart of React lies the concept of components. Components serve as the building blocks of UIs, encapsulating distinct pieces of functionality and rendering logic. Each component operates as a recipe for a specific UI element, defined by a function that returns a React node. By composing these components into a hierarchical tree structure, developers craft intricate user interfaces that form the backbone of React applications.

The Role of React Server

So, what exactly is React Server? In essence, React Server is a process responsible for executing the entire React component tree, with the exception of components marked for deferred execution using “use client”. This process results in a composite output comprising both executed and pending components, ready to be transmitted to the React Client. React Server’s role is pivotal in generating a partially completed React tree, setting the stage for React Client to complete the rendering process.

The Role of React Client

Contrary to React Server, React Client operates in a familiar environment akin to traditional React development. Once it receives the partially completed React tree from React Server, React Client takes charge of finalizing the rendering process. This entails either generating static HTML for server-side rendering (SSR) or attaching the completed tree to the DOM in a browser environment. The sequential execution of React Server followed by React Client ensures a seamless rendering workflow.

Demystifying RSC

At its core, React Server Components are simply React components that undergo execution within the React Server environment. The key differentiator lies not in their intrinsic nature but rather in their execution context and timing. React Server Components leverage the computational environment provided by the server, granting access to resources such as Node.js APIs, file systems, and databases. In contrast, traditional React components executed by React Client operate within the confines of browser APIs.

In React 19, we will see them integrated into core React. Currently, we can use them in Next.js App Router. To be honest, so far, I don’t find them to be a particularly cool feature of React, but some people do.

--

--

Haseeb
Haseeb

No responses yet