What is state management at scale and which library should you choose?

Answer

At scale, React's built-in state tools (useState, useContext) have limitations: context has performance issues for frequently changing state; lifting state creates prop drilling; complex state machines are hard to express. Library comparison: Redux Toolkit: mature ecosystem, predictable state container, excellent DevTools (time-travel debugging), best for large teams and complex state. Boilerplate reduced significantly with RTK. Zustand: minimal API, unopinionated, no providers, excellent performance, growing adoption. Best for medium-complexity apps. Jotai: atomic state model — compose tiny pieces of state (atoms); very fine-grained reactivity (only components using a specific atom re-render). Best for highly dynamic, granular state. Recoil: similar to Jotai, from Meta. MobX: observable-based, automatic reactivity tracking, feels like Vue's reactivity. TanStack Query (React Query): specialized for server state (caching, synchronization, background refetch) — not a general state manager. Combine with Zustand for client state. Decision criteria: team size, complexity, DevTools needs, bundle size, and whether server state is the primary concern (use React Query) vs. complex client state (Redux Toolkit or Zustand).