Stage 2 · Lesson 8 of 8
Server and client components
In the , every component is a unless its file starts with 'use client'. Server components run only on the server. They can be async, read the database or secrets directly, and send none of their own to the browser.
Client components also run in the browser. They are the only place for useState, effects, event handlers like clicks, and browser features. Put 'use client' as low in the tree as you can, for example on a LikeButton rather than the whole page.
Props passed from a server component to a client component must be plain data that can travel as text. So no functions or class instances.
Common trapimporting server-only code, like a database client, into a client component, which breaks the build or leaks it to the browser.
A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- GuideFreeReact Documentation
Meta
Free official course; Thinking in React and Managing State matter most
- CourseFreeNext.js Learn
Vercel · Intermediate
Free official course: the first chapters build pages, layouts and navigation