Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

Zustand

Lightweight state management for React with minimal boilerplate.

State and data fetchingNPM

GitHubWebsite

1. License

License from npm.

github.com/pmndrs/zustand

From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error

What Zustand does

In Zustand the store itself is a React hook. Components select slices from it directly, with no provider around the app, and the same store can run outside React.

Zustand popularity

88 / 100
Gid Score, #14 overall
96.9M
downloads a week, npm
59K
GitHub stars
366
agent projects use it
Zustand: downloads per weeknpm, zustand 96,888,255
Zustand: GitHub starspmndrs/zustand 58,985

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How Zustand is used

  • Zustand is a dependency in 366 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (7.5% of the 4,867 JavaScript/TypeScript ones), #2 of 53 in state and data fetching.
  • Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 1,301; those are left out of every share on this page.
  • The most used alternative in our scan is Jotai (35 projects).
  • Projects that use it most often also use React (98.6%), Lucide React (68.0%), clsx (65.0%).
  • It is more common in projects set up for Kiro (10.7%) than for OpenAI Codex (5.3%).

By coding agent

194 projects, 5.9%
184 projects, 7.5%
165 projects, 5.4%
42 projects, 8.9%
25 projects, 5.3%
24 projects, 8.6%
21 projects, 6.1%
15 projects, 10.7%

Often used with

In 98.6% of its projects
In 68.0% of its projects
In 65.0% of its projects
In 84.7% of its projects
In 62.8% of its projects
In 55.2% of its projects
In 48.4% of its projects
In 80.1% of its projects

Zustand in practice

Strengths

The store is a hook, no provider needed

You define state and actions in one <code>create</code> call and use the returned hook in any component. Nothing has to wrap the app.

Maintainers target known React pitfalls

The docs say a lot of work went into the zombie child problem, React concurrency, and context loss between mixed renderers. They add that it "may be the one state manager in the React space that gets all of these right."

Core runs without React

<code>createStore</code> from <code>zustand/vanilla</code> returns <code>getState</code>, <code>setState</code>, <code>subscribe</code> and <code>getInitialState</code> instead of a hook. You can bind it back to React later with <code>useStore</code>.

Transient updates skip re-renders

For state that changes often, a component can <code>subscribe</code> and write into a ref instead of re-rendering. The README pairs this with <code>useEffect</code> so the subscription is removed on unmount.

Watch out for

Render optimization is your job

The docs state plainly that you apply render optimizations by hand with selectors. Calling the hook with no selector re-renders the component on every state change.

Object selectors need useShallow

Change detection is strict equality by default. A selector that builds a new object or array needs <code>useShallow</code> to avoid unnecessary rerenders.

Replace mode can delete your actions

Passing <code>true</code> as the second argument to <code>set</code> replaces the whole state instead of merging it. Actions stored in the state get wiped too.

Create a store and bind components

import { create } from 'zustand'

const useBearStore = create((set) => ({
  bears: 0,
  increasePopulation: () => set((state) => ({ bears: state.bears + 1 })),
  removeAllBears: () => set({ bears: 0 }),
}))

function BearCounter() {
  const bears = useBearStore((state) => state.bears)
  return <h1>{bears} around here ...</h1>
}

function Controls() {
  const increasePopulation = useBearStore((state) => state.increasePopulation)
  return <button onClick={increasePopulation}>one up</button>
}

More about Zustand

Funding
  • GitHub Sponsors: https://github.com/dai-shi
  • Own page: https://daishi.gumroad.com/l/uaxms
  • Own page: https://daishi.gumroad.com/l/learn-zustand-v4
  • 21 GitHub sponsors

See all

Agent Skills for it
  • zustand-store-ts: Create Zustand stores with TypeScript, subscribeWithSelector middleware, and proper state/action separation. Use when building React state m

See all

Packages around it
  • react: UI library
  • tailwindcss: Utility-first CSS
  • clsx: className builder
  • lucide-react: Icon components
  • eslint: JS/TS linter
  • tailwind-merge: Tailwind class merging
More in State and data fetching

Alternatives

Zustand This page

MITGid 8896.9M/wk

Jotai

Minimal React state management with atoms as primitive building blocks for flexibility.

MITGid 7211M/wk

Compare Zustand with another tool

Get started

Install it.

npm install zustand

Rules for your agent

Paste into AGENTS.md or CLAUDE.md
## Zustand
- Always pass a selector to the store hook, e.g. `useBearStore((state) => state.bears)`. Calling it with no selector re-renders the component on every state change.
- When a selector returns a new object or array, wrap it in `useShallow` from `zustand/react/shallow`. The default comparison is strict equality.
- Update state immutably. `set` merges the top level. Never pass `true` as the second argument unless you mean to replace the whole state, actions included.
- For Map and Set values, create new instances on every update.
- Do not add state in React Server Components with the module-level `getState`/`setState` technique. The README warns about bugs and privacy issues (typically Next.js 13 and above).
- In TypeScript, write `create<State>()(...)` instead of `create(...)`.
- For dependency injection through React context, put a vanilla `createStore` store in the context and read it with `useStore`. Do not put the hook itself in context.