Skip to content
Web Design & Development

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.

MediaScaleUp Editorial Team 2 min read 13 views
A Practical Guide to React Server Components

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?

  1. Keep data fetching in server components
  2. Mark only interactive parts as client components
  3. Pass serializable props from server to client components
  4. Measure bundle size before and after
  5. Keep secrets in server-only modules
What to do and what to avoid with React server components, side by side
Good practice against the usual mistakes, from the sources listed below.

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

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.

All services

The work behind this article, and what it costs.

MediaScaleUp Editorial Team

Articles here are researched, written and checked by the MediaScaleUp studio team before they are published, and dated when they are reviewed.

Keep reading

More in Web Design & Development