Nextjs Fundamentals · Server & Client Components

Passing data across the boundary

serializable props

Passing data across the boundary

Props that cross from a Server Component to a Client Component are encoded into the RSC Payload, so they must be serializable. React's serializer is richer than JSON — it handles strings, numbers, booleans, null, undefined, arrays, plain objects, Date, Map, Set, Promise, typed arrays, and JSX elements.

What it cannot carry is a function or a class instance. This fails:

// A Server Component
<Chart format={(n) => n.toFixed(2)} />

React raises: Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with 'use server'.

A function marked 'use server' is a Server Function. It crosses the boundary as a reference, not as code: the client receives a stub that makes a network request back to the server when called. That is why Server Functions are the one function shape allowed in props.

Class instances and DOM nodes cannot cross either. When you hit this error, the fix is usually to pass plain data — the primitive or object values the component needs — and let the Client Component build whatever it needs from them.

You are about to answer a short quiz on serializable props.

  1. Props passed from a Server Component to a Client Component must be serializable.
  2. You can pass a plain function as a prop from a Server Component to a Client Component.
  3. A function marked with ___ can be passed across the boundary because the client receives a reference, not the code.
  4. Plain objects, arrays, strings, numbers, and Dates can all cross the boundary.
  5. Serializable props are encoded into the ___ sent to the browser.
  6. Class instances and DOM nodes can be passed as props to a Client Component.