React · Senior · Question 68 of 75
How can a Server Component start a fetch but let a Client Component wait for it?
// server
const commentsPromise = getComments(postId);
return <Comments commentsPromise={commentsPromise} />;
// client
const comments = use(commentsPromise);- ✓Correct answer: Pass the promise as a prop; the client reads it with
useinside Suspense - 2Promises can't cross the server/client boundary
- 3Await on the server and pass a callback
Explanation
Promises are serializable props. The page shell renders immediately, and the comments stream in when the promise resolves.