React · Senior · Question 11 of 75
How do you render a Server Component inside a client <Modal>?
- ✓Correct answer: Pass it as
children(or another prop) from a Server Component parent - 2Import the Server Component directly in the
Modalfile with'use client' - 3Wrap the Server Component in
React.lazyinside the client module
Explanation
A client module can't import a server component - the import would make it a client component. But a server parent can render <Modal><ServerCart /></Modal>: ServerCart runs on the server, and Modal receives the ready result as children.