Comparing
Primitive and flexible state management for React based on atomic state units.
Hooks for managing, caching and syncing asynchronous and remote data in React
| Metric | jotai | react-query |
|---|---|---|
| Ecosystem | npm | npm |
| Difficulty | Beginner | Beginner |
| Weekly downloads | 900K | 1.6M↑ |
| Latest version | v2.9.3 | v3.39.3 |
| Recipes | 2↑ | 1 |
jotai only
Shared
react-query only
React apps needing shared state without prop drilling, derived/computed state that updates automatically, fine-grained re-render control, per-route or per-feature isolated state.
Use React Query for any React app that fetches server data: REST APIs, GraphQL, or any async function. It replaces 95% of the useEffect+useState patterns for data fetching and adds caching, background refetching, and optimistic updates for free.
Non-React environments (Jotai is React-only). Complex state machines (use XState). Apps already committed to Redux with large middleware ecosystems.
React Query is for server state (data that lives on a server). For UI state (modals, form values, local toggles), use useState or Zustand. If you're already using a full data layer like Apollo Client for GraphQL, React Query is redundant.
jotai
react-query