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

by
Ali Hasan
aws-aurora-serverless next.js reactjs server-side-rendering

The Problem:

Compare React Server Components (RSC) introduced in React 18 with Server Side Rendering (SSR) available in frameworks like Next.js. Highlight their differences and similarities in terms of functionality, performance, and usage.

The Solutions:

Solution 3: React Server Components vs Server Side Rendering

React Server Components (RSC) are a new type of component that can be rendered only on the server and sent to the client as HTML. Unlike SSR, RSC keeps the state of any components in the client, meaning that it cannot be hydrated like SSR. As a result, you cannot use React hooks or event listeners on server components.

For example, if you have a parent component (server component) with an input (client component) for searching, and you attach an onChange event to the input, whenever you type something, the whole parent component will re-render. With RSC, the old state will be kept on the client side, preserving the data that was typed in the input element. In contrast, SSR will cause the entire page to refresh, overwriting the input value.

Video Explanation:

The following video, titled "The Difference Between React Server Components (RSC) & Server ...", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

The Difference Between React Server Components (RSC) & Server Side Rendering (SSR). 1.7K views · 5 months ago ...more ...