0

Composition (server inside client)

Modelused in ~92% of apps

Tutorials tell you to 'add "use client" and import what you need.' Do that around a data-heavy component and you quietly ship your whole database layer to the browser. The senior pattern is the opposite: let a client shell hold server-rendered content it never imports — it only receives it.

Core idea. A Client Component cannot import a Server Component and keep it on the server — importing pulls it into the client bundle. To keep server work server-side underneath an interactive shell, you pass the Server Component IN as `children` (or a prop) from a server parent. The client owns the interactivity; the server-rendered nodes just ride along as already-rendered output.
Playground, this isn't a screenshot
component tree server client
<LikeButton />Server Component
Build error: useState / onClick are not allowed in a Server Component. Add "use client" to fix it.
Render HTML / read props
await data directly (db, fetch)
useState / useEffectclient only
onClick & event handlersclient only
window / localStorageclient only
JS shipped to browser0 KB
JavaScript shipped to the browser0 KB / 71 KB if all client

2 interactive component(s) are still Server Components— they would crash the build because Server Components can't use state or event handlers. Select one and add "use client".

↑ play a little first, then dig in