pkgdocs/compare/jotai vs react-query

Comparing

npm

jotai

Primitive and flexible state management for React based on atomic state units.

900K/ wk
v2.9.3
vs
npm

react-query

Hooks for managing, caching and syncing asynchronous and remote data in React

1.6M/ wk
v3.39.3
Metricjotaireact-query
Ecosystemnpmnpm
DifficultyBeginnerBeginner
Weekly downloads900K1.6M↑
Latest versionv2.9.3v3.39.3
Recipes2↑1

Tags

jotai only

stateatomshooks

Shared

reacttypescript

react-query only

data-fetchingcachingserver-stateasynccachedatafetchgraphql

When to use each

jotai

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.

react-query

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.

When to skip each

jotai

Non-React environments (Jotai is React-only). Complex state machines (use XState). Apps already committed to Redux with large middleware ecosystems.

react-query

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.

Sample recipes

jotai

  • Replace useState with a shared atom
  • Derived atom for computed state

react-query

  • Install react-query