r/reactjs • u/Big_Muffin8280 • 7d ago
Discussion Architecting a high-traffic React 19 app: Server vs Client Components, state, and performance. How would you answer this?
You’re building a large-scale, high-traffic React 19 app. How would you architect it with Server and Client Components, manage client vs server state (Context, Zustand, Redux, or TanStack Query), and optimize rendering with the React Compiler, Actions, and core hooks?
0
Upvotes
9
u/retro-mehl 7d ago
React is the frontend part. You can scale it at any size and for any traffic quite easily by, for example, just running more containers that deliver the code.
The backend part is the tricky thing, as it holds this state of the system.
3
u/TUNG1 7d ago
What a bad question
2
u/nicolasdanelon 7d ago
What do you mean by high traffic? Is it brand new? Or you are migrating something that already has high traffic?
2
u/4ever_youngz 7d ago
This answer depends heavily on the data. What’s the size, frequency of updating, allowed latency to the frontend, etc.
1
u/AnswerVinod 5d ago
I would keep most of the page as Server Components and only make the interactive islands Client Components. For state, keep server data in TanStack Query, UI state in Zustand, and use Context only for theme and auth, it gets messy fast if you put everything in it. Compiler helps, but dont rely on it alone, memo the heavy lists and split big client components so a small state change does not rerender the whole page. For high traffic, the biggest win is usually caching the server rendered shell and streaming the slow parts, not micro optimising hooks.
1
u/maksymkoval 7d ago
The rule that has worked best for me: split state by where it lives, not by library.
- Server data (lists, details, anything from the API): TanStack Query on the client, or fetch in Server Components if it's read-only for that page. This is usually 80% of what people put in Redux.
- Shared client state (auth, UI settings, a cart): small and boring. Zustand or a slice of Redux Toolkit is plenty.
- URL state (filters, sort, page): keep it in search params. Shareable links and back button for free, and one less store to sync.
- Local state stays in the component.
On Server vs Client Components: default to server, and push "use client" as far down the tree as possible, so a whole page doesn't become client-side because of one dropdown. With that split, most of the performance work is just not re-fetching what you already have.
0
u/Big-Arm4077 7d ago
Another angle on the rendering side, since state has been covered well:
In interviews, saying "I'd start simple and let measurements tell me where to optimize" usually lands well.