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:

  1. HTML Markup for Server Components (pre-rendered on the server).

  2. Component Data (JSON-like) for dynamic parts or placeholders.

  3. 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?

  1. 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.
  2. 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.

  3. 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.

0
Subscribe to my newsletter

Read articles from pragalbh srivastav directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

pragalbh srivastav
pragalbh srivastav