Use this file to discover Exa products, pricing, evaluations, comparisons, use cases, agent interfaces, and technical documentation before exploring further.
React state management libraries hold shared state that components can read without passing props through every level of the component tree. Components use hooks to subscribe to selected store or atom values, where a change to a subscribed value triggers a re-render. These libraries keep data such as the signed-in user or a shopping cart in one place, where every screen of an app reads the same value.
Popularity
Zustand has the most monthly downloads in this comparison, at 346.8M.
Downloads: npm, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.
Libraries and code examples
Zustand
Zustand keeps application state in a store created by create, and the store itself is a React hook. A component calls the hook with a selector, such as (state) => state.bears, and renders again only when that selected value changes. No provider component wraps the app, and one store holds plain values, objects, and the functions that update them. Those functions call set, which merges the new values into the existing state one level deep.
Downloads / mo
351.6M
Stars
58.9K
Last release
5.1.0
License
MIT
Strengths
Reads state without provider wrappers.Read shared state through hooks without wrapping components in a provider.
Persists state with bundled middleware.Save selected store data to synchronous or asynchronous storage.
Limitations
Updates only merge one level.Copy nested objects explicitly when changing values inside them.
async function resolveFitView() {
const { nodeLookup, panZoom, fitViewOptions, fitViewResolver, width, height, minZoom, maxZoom } = get();
if (!panZoom) {
return;
}
await fitViewport(
{
nodes: nodeLookup,
width,
height,
panZoom,
minZoom,
maxZoom,
},
fitViewOptions
);
fitViewResolver?.resolve(true);
/**
* wait for the fitViewport to resolve before deleting the resolver,
* we want to reuse the old resolver if the user calls fitView again in the mean time
*/
set({ fitViewResolver: null });
}
Redux Toolkit
Redux Toolkit is the official package for writing Redux logic, and it replaces most of the setup that plain Redux needs. configureStore creates the store, and createSlice takes an initial state and a set of reducer functions and generates the matching action creators. Data from a server goes through RTK Query, a layer built into the package that handles requests, caching, loading state, and refetching. React apps also install React Redux, which the official templates configure alongside it.
Downloads / mo
186.4M
Stars
11.2K
Last release
2.14.0
License
MIT
Strengths
Includes request caching.Use RTK Query for loading, caching, invalidation, and refetching.
Generates reducers and action creators.Generate matching reducers and actions from a slice definition.
Limitations
State values should be serializable.Keep functions and other non-serializable values outside Redux state.
Persistence needs an additional package.Add a persistence library to save state across page reloads.
TanStack Store is an immutable, reactive data store that sits at the core of the other TanStack libraries. createStore defines the state, often outside any component, and setState replaces it with an updated copy. In React, useSelector reads one part of the store, and the component renders again only when that part changes. Adapters for Solid, Vue, Angular, and Svelte share the same store code.
Downloads / mo
139.0M
Stars
916
Last release
0.11.2
License
MIT
Strengths
Selector-scoped renders.A component that reads one field with useSelector skips renders caused by other fields.
Limitations
Renamed read hook.useStore remains only as a deprecated alias for useSelector, which new code calls instead.
export function useRouterState<
TRouter extends AnyRouter = RegisteredRouter,
TSelected = unknown,
TStructuralSharing extends boolean = boolean,
>(
opts?: UseRouterStateOptions<TRouter, TSelected, TStructuralSharing>,
): UseRouterStateResult<TRouter, TSelected> {
const contextRouter = useRouter<TRouter>({
warn: opts?.router === undefined,
})
const router = opts?.router || contextRouter
// During SSR we render exactly once and do not need reactivity. // Avoid subscribing to the store (and any structural sharing work) on the server. // The expression must stay inlined in the `if` so bundlers fold the // browser-build constant `isServer = false` and drop this server block. if (isServer ?? router.isServer) {
const state = router.stores.__store.get() as RouterState<
TRouter['routeTree']
>
return (opts?.select ? opts.select(state) : state) as UseRouterStateResult<
TRouter,
TSelected
>
}
// eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static return useSelector(
router.stores.__store,
// eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static useStructuralSharing(opts, router),
) as UseRouterStateResult<TRouter, TSelected>
}
Nano Stores
Nano Stores builds state from many small stores that live in plain modules outside components. An atom holds one value, read with get and changed with set, and computed derives a new store from others, such as the admins filtered from a list of users. Adapter packages, such as @nanostores/react, connect the same stores to React, Preact, Vue, Svelte, Solid, Lit, and Angular. The core has zero dependencies and stays under one kilobyte, minified and compressed.
Downloads / mo
76.6M
Stars
7.6K
Last release
1.5.5
License
MIT
Strengths
Shared across frameworks.One set of stores serves components written in React, Vue, Svelte, and other frameworks through small adapters.
Jotai stores state as atoms, each created by atom with an initial value such as a string, number, object, or array. Inside a component, useAtom returns the value and a setter, the same pair that useState returns. Passing a read function to atom creates a derived atom whose value comes from other atoms, and that function can be async to load data. Code refers to atoms as objects, with no string keys, unlike Recoil.
Downloads / mo
36.9M
Stars
21.3K
Last release
3.0.2
License
MIT
Strengths
Derives values from other atoms.Combine existing state values into values calculated from them.
Persists individual state values.Use atomWithStorage to save selected values across browser reloads.
Limitations
Atoms need stable references.Reuse atom objects across renders to avoid infinite render loops.
Stored values can mismatch HTML.Render storage-dependent content after browser state has loaded.
export const useAtomWithInitialValue = <
T extends unknown,
A extends PrimitiveAtom<T>,
>(
atom: A,
initialValue: T | (() => T),
) => {
const [value, setValue] = useAtom(atom);
useLayoutEffect(() => {
if (typeof initialValue === "function") {
// @ts-ignore setValue(initialValue());
} else {
setValue(initialValue);
}
// eslint-disable-next-line react-hooks/exhaustive-deps }, []);
return [value, setValue] as const;
};
XState
XState models application logic as state machines and statecharts: named states, the events that move between them, and actors that run them. createMachine defines the states and transitions, createActor starts an actor from that definition, and send delivers an event such as { type: 'play' }. The package has no runtime dependencies and runs in frontend and backend code. For a plain store without machines, the same project publishes @xstate/store.
Downloads / mo
31.2M
Stars
30.5K
Last release
5.33.4
License
MIT
Strengths
Visual editor.Stately Studio draws machines as diagrams and edits them visually.
Limitations
Beta in the quick start.The README's quick start installs xstate@beta, the next major version, rather than the current stable release.
MobX tracks which observable values each computation reads, so a React component wrapped in observer renders again only when those values change. makeAutoObservable turns an object's fields into observable state and its methods into actions. Updates are ordinary assignments, made from event handlers, timers, or asynchronous code. Derived values, called computeds, stay cached until the observables they read change. The state lives outside any UI framework, and the React bindings ship in the separate mobx-react-lite package.
Downloads / mo
17.7M
Stars
28.2K
Last release
7.1.7
License
MIT
Strengths
Tracks component dependencies automatically.Update React components when the state they read changes.
Caches values derived from state.Cache calculated values until the state they read changes.
Limitations
Async updates need action wrappers.Wrap state changes after await in runInAction.
Valtio wraps a plain object in a proxy with proxy, and code changes it by assigning to its fields from anywhere, such as a timer callback. In a component, useSnapshot returns a read-only snapshot and renders the component again only when a field it read has changed. Outside React, subscribe runs a callback on every change to the whole state or to one nested object.
Downloads / mo
12.2M
Stars
10.2K
Last release
2.3.2
License
MIT
Strengths
Direct mutation.Event handlers and plain functions change state by assigning to the proxy's fields.
Limitations
Snapshots are frozen.A method called on a snapshot can't change state. The README recommends arrow functions that change the proxy directly.
export function createDatabaseSettingsState() {
const state = proxy({
usePoolerConnection: true,
setUsePoolerConnection: (value: boolean) => {
state.usePoolerConnection = value
},
showPoolingModeHelper: false,
setShowPoolingModeHelper: (value: boolean) => {
state.showPoolingModeHelper = value
},
})
return state
}
FAQ
For one shared store read through hooks, Zustand needs no provider component. Jotai keeps many small values as atoms that combine into derived ones, and Redux Toolkit adds RTK Query for loading and caching server data. MobX and Valtio let code change state by plain assignment.
Zustand stores state in a hook that any component calls without a provider, and the functions that update the state live in the same store. Redux Toolkit is the official way to write Redux logic: createSlice generates actions and reducers, and RTK Query handles server data. An app that already uses Redux keeps its store and moves to Redux Toolkit.
Zustand keeps state in one store, and each component selects the part it reads. Jotai keeps each value in its own atom, used like useState, and builds derived atoms from other atoms. Both libraries work without a provider component.
React Context passes a value through the component tree with no extra package. Zustand's README lists three differences from Context: less boilerplate, components that render only on changes, and centralized, action-based updates.
TanStack Store is an immutable, reactive data store that sits at the core of the other TanStack libraries. Its React adapter reads state with useSelector, which renders a component again only when the selected value changes.
MobX tracks which observable values each component reads, so updates are plain assignments and only the affected components render again. Redux Toolkit routes every change through actions and reducers defined in slices, and its usage guide keeps state to serializable values.
For coding agents
Found your state management library? Help your agent use it.
Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.