How React's serializer decides what crosses the Server Component boundary
React Server Components use a single serializer to evaluate every prop passed to a client component, encoding supported values and throwing an error on the first unsupported one. Developers are often caught off guard because some values appear valid but fail silently or only at build time — for example, Error objects lose their message in production while the build still passes. Class instances are rejected not because they are classes but due to a prototype check, meaning even a data-only instance that looks like a plain object will throw unless spread into one. Functions are only blocked when React cannot identify them as client or server references, and the resulting error message varies based on the prop name rather than pointing to the source file. A config object containing an arrow function as a nested key is treated as a function prop, causing a prerender failure with a misleading event-handler error because React tests the object key name, not the JSX attribute.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in