Skip to content

Notes from rewriting with React Server Components

Server Components simplify data fetching — until you draw the boundary wrong, and pay for it in hydration errors.

Contents

After migrating the whole site to the App Router, the error I hit most was not a type error — it was hydration mismatch.

Never read browser state during render

Anything undecidable on the server — localStorage, matchMedia, new Date() — must stay out of the first paint.

The pattern I settled on: a stable server default, then an effect that swaps in the real value after mount.

Push the client boundary down

One 'use client' pulls the whole subtree into the client bundle, so it belongs as close as possible to the element that actually needs interactivity.

The higher you draw the boundary, the more it costs.
ShareX / Twitter
You might also like

You might also like

Comments

Say the first thing

Write a comment

Not published
Optional — shown next to your name once approved
Your comment is awaiting review.
Letters

If you liked this, letters are open

Roughly one or two a month · No ads, no forwarding · Used only to send letters. Never shared.

Contact

Tell me what you are working on and what you need.

Usually replies within 1–2 business days