A Practical Guide to React Server Components
React components that render on the server and send their output to the browser without shipping their code, used in frameworks such as Next.js.
On this page
Why does it matter?
They can reduce the JavaScript sent to browsers, but they change how data fetching, state and interactivity are organized.
What are the numbers?
- Server components render on the server and do not add to the client bundle
- Client components marked with the use client directive and run in the browser
- Data fetching server components can fetch data directly
- Interactivity event handlers and state require client components
What should I do?
- Keep data fetching in server components
- Mark only interactive parts as client components
- Pass serializable props from server to client components
- Measure bundle size before and after
- Keep secrets in server-only modules
What should I avoid?
Avoid:
- Marking whole pages as client components
- Leaking server secrets into client code
- Assuming server components improve every page
- Mixing patterns without team conventions
When should I get help?
Short answer Bring in help when migrating a React app to server components, or when bundle sizes stay large.
Where this comes from
- React — Server Components
- Next.js Documentation — Server and Client Components
The figures and practices above come from the sources listed.
Working on something like this?
We take on Web Design & Development work for teams who want it done once, properly. Tell us what you are building and we will tell you honestly whether we are the right studio for it. Start a project.
Where to go next
Spotted something wrong? Report an error on this page. We correct on the page and say what changed.