A practical guide to server-first React
How to think about React in a server-first world, without losing the client.
React is very good at rendering, and server-first frameworks are very good at deciding what to render. The interesting work is in the seam between them.
Start with the request
A server-first page begins with a request, not a component tree. Load the data that the page needs, decide what is missing, and only then render. This ordering removes a whole class of client-side loading states.
- Read cookies and headers at the request boundary.
- Resolve redirects before rendering.
- Return a typed result that distinguishes "missing" from "empty".
The client should not have to rediscover those states with a second request.
Keep the client for interactions
Server rendering is not an argument against client components. It is an argument against using the client for decisions that the server can make once. Keep the client for focus, drag, optimistic input, and anything that depends on the user's immediate context.
A useful rule: if the value is already known when the response is created, render it on the server. If the value changes while the user is looking at the page, it belongs to the client.
Avoid the double fetch
The most common mistake is loading data on the server, serialising it into the page, and then fetching it again on mount "to keep it fresh". Pick one owner for the data. If the server owns it, invalidate explicitly after a mutation. If the client owns it, do not render a server copy that will immediately disagree.
Server-first is a data-ownership decision, not a rendering trick.
Measure the seam
The seam has a cost: serialisation, hydration, and the size of the client bundle. Measure it. A page that ships 200 KB of JavaScript to render a list of links is not server-first in any meaningful sense.
The practical version of this guide is short: let the server decide, let the client interact, and keep the contract between them small enough to inspect.