AceDevHub
Advanced React Interview QuestionsAdvancedConcept

React · Question 94

Why do values crossing a Server Component to Client Component boundary need to be serializable?

Direct answer

React must encode values crossing the server/client boundary into the transport format, so props must use supported serializable values rather than arbitrary local functions, class instances, or non-serializable runtime objects.

  • Commonly safe: strings, numbers, booleans, null, supported plain data structures, and other values explicitly supported by the RSC serialization contract.
  • Functions: ordinary local functions cannot cross the boundary; Server Functions are the special supported function case.
  • Design impact: shape server data into client-facing DTO-like values rather than passing arbitrary server objects through the boundary.

This boundary is also useful architecturally: it forces the client-facing contract to be explicit instead of accidentally leaking server implementation details.