Question presented to candidate: "A server page loads a product and a Client Component needs it. How do you pass it, what can and cannot cross, and what do you do with a function you want to call on click?"
What a strong answer should cover:
- Pass data as props; everything that crosses must be serializable by React.
- Supported: primitives, plain objects and arrays,
Date,Map,Set,BigInt, typed arrays, promises, JSX elements and Server Actions. - Rejected: plain functions, event handlers, class instances and objects with a null prototype.
- A promise can be passed without awaiting and unwrapped in the client with
use(), so the server can start streaming earlier. - Pass only what the client needs; every prop ends up in the page payload and is visible to the user.
Clarifying questions expected:
- "Does the client need the whole record?" β send a slimmed object, not the database row.
- "Must the page wait for this data?" β if not, pass the promise and wrap the client in Suspense.
Code / implementation expected: Yes β a server page passing a value, a promise and a Server Action.