jotai, mobx-react, mobx-react-lite, react-redux, recoil, redux, and zustand are state management libraries designed to handle application state in React, while react-query specializes in server state management, including data fetching, caching, and synchronization. These libraries address different aspects of state: some focus on local UI state, others on global state, and react-query specifically handles asynchronous server state with built-in caching, background updates, and optimistic updates.
Managing state in React apps isn’t one-size-fits-all. Some libraries handle local UI state, others global client state, and a few specialize in server state. Let’s compare how each of these eight packages tackles real-world problems.
redux treats state as a single, immutable tree. Every change requires a pure reducer function and an action object.
// redux
const increment = { type: 'INCREMENT' };
const counterReducer = (state = 0, action) => {
if (action.type === 'INCREMENT') return state + 1;
return state;
};
react-redux is just the React binding for Redux — it doesn’t manage state itself but connects Redux stores to components.
// react-redux
import { useSelector, useDispatch } from 'react-redux';
function Counter() {
const count = useSelector(state => state.counter);
const dispatch = useDispatch();
return <button onClick={() => dispatch(increment)}>{count}</button>;
}
zustand uses a single store with direct setter functions. No actions, no reducers — just a hook that gives you state and setters.
// zustand
import { create } from 'zustand';
const useStore = create((set) => ({
count: 0,
inc: () => set((state) => ({ count: state.count + 1 }))
}));
function Counter() {
const { count, inc } = useStore();
return <button onClick={inc}>{count}</button>;
}
jotai models state as “atoms” — tiny units of state that can be read, written, or derived. No provider needed.
// jotai
import { atom, useAtom } from 'jotai';
const countAtom = atom(0);
const Counter = () => {
const [count, setCount] = useAtom(countAtom);
return <button onClick={() => setCount(c => c + 1)}>{count}</button>;
};
recoil also uses atoms and selectors, but requires a <RecoilRoot> provider at the top of your app.
// recoil
import { atom, useRecoilState } from 'recoil';
const countAtom = atom({ key: 'count', default: 0 });
const Counter = () => {
const [count, setCount] = useRecoilState(countAtom);
return <button onClick={() => setCount(c => c + 1)}>{count}</button>;
};
mobx-react and mobx-react-lite rely on MobX’s observable state. You mutate state directly, and React components automatically re-render when observed values change.
// mobx-react-lite
import { observer } from 'mobx-react-lite';
import { makeAutoObservable } from 'mobx';
class Store {
count = 0;
constructor() { makeAutoObservable(this); }
inc = () => { this.count += 1; };
}
const store = new Store();
const Counter = observer(() => (
<button onClick={store.inc}>{store.count}</button>
));
react-query doesn’t manage client state — it manages server state. You define queries, and it handles fetching, caching, background updates, and more.
// react-query
import { useQuery } from '@tanstack/react-query';
function UserProfile({ userId }) {
const { data, isLoading } = useQuery({
queryKey: ['user', userId],
queryFn: () => fetchUser(userId)
});
if (isLoading) return <div>Loading...</div>;
return <div>{data.name}</div>;
}
redux + react-redux: Requires creating a store, wrapping your app in <Provider>, defining actions/reducers, and connecting components.zustand: Zero providers. Just call create() and use the hook anywhere.jotai: No provider needed (unless using advanced features like persistence).recoil: Must wrap your app in <RecoilRoot>.mobx-react: Needs <Provider> if using inject; otherwise, just pass stores via props or module imports.mobx-react-lite: No provider needed — just use observer on components.react-query: Requires <QueryClientProvider> at the root, but that’s it.All modern libraries avoid unnecessary re-renders, but they do it differently:
redux/react-redux: Components re-render only if the slice they select changes (thanks to shallowEqual by default).zustand: Uses a selector pattern — only re-renders if the selected state changes.jotai and recoil: Subscribe components only to the specific atoms they use.mobx-react-lite: Automatically tracks which observables a component uses and re-renders only when those change.react-query: Caching means components often get data instantly from cache, avoiding loading spinners and extra renders.Need computed values or async data?
jotai supports async atoms and derived atoms natively:
// jotai async atom
const userAtom = atom(async (get) => {
const id = get(userIdAtom);
const res = await fetch(`/api/user/${id}`);
return res.json();
});
recoil uses selectors for derived state and async queries:
// recoil selector
const userNameSelector = selector({
key: 'userName',
get: async ({ get }) => {
const user = await fetchUser(get(userIdAtom));
return user.name;
}
});
mobx lets you create computed properties:
// mobx computed
class UserStore {
@observable users = [];
@computed get activeUsers() {
return this.users.filter(u => u.active);
}
}
react-query is built for async — it handles retries, stale-while-revalidate, pagination, and mutations out of the box.
redux typically needs middleware like redux-thunk or redux-saga for async logic, though Redux Toolkit simplifies this.
zustand can handle async in setters:
// zustand async
const useStore = create((set) => ({
user: null,
fetchUser: async (id) => {
const user = await api.getUser(id);
set({ user });
}
}));
mobx-react includes legacy APIs (Provider/inject) that are rarely needed in modern React. Prefer mobx-react-lite for function components.recoil development has significantly slowed since mid-2023, with Meta recommending alternatives like Jotai for new projects.redux is not deprecated — but Redux Toolkit is now the standard way to use it, reducing boilerplate dramatically.react-query (now part of TanStack Query) is actively maintained and widely adopted for server state.It’s common — and often smart — to use more than one:
react-query for server data + zustand or jotai for client UI state.redux for server state — that’s what react-query is for.mobx and redux — they solve the same problem with opposite philosophies (mutable vs immutable).| Library | State Type | Provider Needed? | Async Built-in? | Best For |
|---|---|---|---|---|
redux | Global client | Yes (via react-redux) | No (needs middleware) | Large apps needing strict predictability |
react-redux | React binding only | Yes | No | Connecting Redux to React |
zustand | Global client | No | Yes (in setters) | Simple, hook-based global state |
jotai | Atomic client | No | Yes | Fine-grained, modern state without providers |
recoil | Atomic client | Yes | Yes | Large apps with complex derived state (use cautiously) |
mobx-react | Observable client | Optional | Yes (via reactions) | Legacy class-component apps |
mobx-react-lite | Observable client | No | Yes | Modern MobX apps with function components |
react-query | Server | Yes | Yes | Any app that fetches data from APIs |
react-query. It solves problems you didn’t know you had (stale data, background refetching, etc.).zustand or jotai will save you hours of boilerplate.redux + Redux Toolkit still shines.mobx-react-lite is clean and powerful.recoil for new greenfield projects unless you have a strong reason — its future is uncertain.The best architecture often uses two tools: one for server state (react-query) and one for client state (zustand, jotai, or redux). Trying to force everything into one system usually leads to pain.
Choose react-query when your app heavily relies on server data — fetching, caching, background updates, pagination, mutations, and more. It eliminates the need to manually manage loading states, refetching logic, or cache invalidation. Essential for data-intensive applications with complex server interactions.
Choose jotai if you want a minimal, atomic state model inspired by Recoil but without the need for a root provider. It integrates well with Concurrent React and supports derived atoms and async atoms out of the box. Ideal for teams seeking a lightweight, modern alternative to Redux or Context API with less boilerplate.
Choose mobx-react if you're already using MobX for state management and need full integration with class components and legacy React patterns. However, note that this package is heavier than mobx-react-lite and includes features like Provider and inject that are unnecessary for most modern function component-based apps.
Choose mobx-react-lite if you're using MobX with function components and hooks. It provides the essential observer HOC and useLocalObservable hook without the overhead of legacy APIs. Best for projects that benefit from MobX’s mutable, reactive programming model and automatic tracking.
Choose react-redux if you're using Redux and need official, optimized bindings for React. It provides hooks like useSelector and useDispatch and ensures efficient re-renders. Use it when your team values Redux’s strict unidirectional data flow, middleware ecosystem (like Redux Toolkit), and dev tools.
Choose recoil if you prefer a fine-grained, atom-based state model with selectors for derived state and built-in async support. It avoids global re-renders by subscribing components only to the atoms they use. Best for large apps where performance and state composition are critical, though development has slowed since 2023.
Choose redux if you need a predictable, centralized store with strict immutability, middleware support, and time-travel debugging. It’s best paired with Redux Toolkit to reduce boilerplate. Suitable for complex applications requiring strong state consistency, auditability, and large-scale team coordination.
Choose zustand if you want a simple, hook-based global state solution without providers or context. It uses a single store with direct mutation support (via immer-style updates) and avoids re-rendering unrelated components. Great for small to medium apps or teams tired of Redux boilerplate.

You're looking at the v3 version of react-query. Starting with v4, react-query is now available as @tanstack/react-query
Find the docs at https://tanstack.com/query/latest