Recall & Review
beginner
What is a Server Component in Next.js?
A Server Component runs only on the server. It can fetch data securely and render HTML before sending it to the browser. It does not include client-side JavaScript by default.
Click to reveal answer
beginner
What is a Client Component in Next.js?
A Client Component runs in the browser. It can use React hooks like useState and handle user interactions. It includes JavaScript sent to the client.
Click to reveal answer
beginner
How do you mark a component as a Client Component in Next.js?
Add the directive 'use client' at the top of the component file. This tells Next.js to bundle it for the browser.
Click to reveal answer
intermediate
Why compose Server and Client Components together?
Composing them lets you fetch data and render static parts on the server, while interactive parts run on the client. This improves performance and user experience.
Click to reveal answer
intermediate
Can a Server Component import a Client Component in Next.js?Yes, a Server Component can import and render a Client Component. But a Client Component cannot import a Server Component.Click to reveal answer
Which directive marks a component as a Client Component in Next.js?
✗ Incorrect
The directive 'use client' at the top of a file tells Next.js to treat the component as a Client Component.
Where does a Server Component run?
✗ Incorrect
Server Components run only on the server and send rendered HTML to the browser.
Which of these can a Client Component do that a Server Component cannot?
✗ Incorrect
Client Components can use React hooks like useState to handle user interactions.
Can a Client Component import a Server Component?
✗ Incorrect
Client Components cannot import Server Components because Server Components run only on the server.
What is a benefit of composing Server and Client Components?
✗ Incorrect
Composing Server and Client Components improves SEO by server rendering and adds interactivity with client-side code.
Explain how Server and Client Components work together in Next.js and why this composition is useful.
Think about where code runs and what each component type can do.
You got /5 concepts.
Describe how to create a Client Component in Next.js and what special directive is needed.
Focus on the special string at the top of the file.
You got /4 concepts.