RSC Payload?

The RSC payload (React Server Components payload) is the serialized data sent from the server to the client to render React Server Components (RSC) in a Next.js application. This payload contains a mix of:
HTML Markup for Server Components (pre-rendered on the server).
Component Data (JSON-like) for dynamic parts or placeholders.
Instructions for React to hydrate and render Client Components.
This payload is essential for efficiently rendering a page, as it reduces the need to send the entire JavaScript bundle to the client for rendering.
How Does the RSC Payload Work?
Server-Side Content:
- The server pre-renders parts of the page that don't need to change, like a header or footer, and sends this HTML directly to the browser.
Interactive Content:
For interactive parts, like buttons or forms, the server doesn't send the full JavaScript code. Instead, it sends a reference to these components.
The browser then loads just the necessary JavaScript to make these parts interactive.
What’s Inside the Payload?:
HTML for static content that can be displayed right away (like text, images, or lists).
References for dynamic parts (like buttons or forms) so the browser knows which JavaScript to load for interactivity.
Subscribe to my newsletter
Read articles from pragalbh srivastav directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by