{
 "kind": "tool",
 "slug": "zustand",
 "path": "tools/zustand/",
 "name": "Zustand",
 "maker": null,
 "density": "profile",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "State and data fetching",
   "tools/state-data/"
  ]
 ],
 "lead": "Lightweight state management for React with minimal boilerplate.",
 "chips": [
  {
   "label": "State and data fetching",
   "path": "tools/state-data/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install zustand"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/pmndrs/zustand"
  },
  {
   "label": "Website",
   "href": "https://github.com/pmndrs/zustand"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "MIT",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": null,
   "note": "License from npm.",
   "src": "https://github.com/pmndrs/zustand"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Nov 23, 2026",
   "note": "Latest GitHub release Nov 6, 2026. ",
   "src": "https://github.com/pmndrs/zustand"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "366 projects",
   "status": "info",
   "sub": "#2 of 53 in its category",
   "note": "Dependency in 366 public GitHub projects set up for AI coding agents that we scanned (5.8%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Docs for agents",
   "status": "yes",
   "sub": "llms.txt",
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": "https://zustand.docs.pmnd.rs/llms.txt"
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What Zustand does",
   "parts": [
    {
     "t": "prose",
     "text": "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."
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "Zustand popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "88",
       "of": "/ 100",
       "l": "Gid Score, #14 overall"
      },
      {
       "n": "96.9M",
       "l": "downloads a week, npm"
      },
      {
       "n": "59K",
       "l": "GitHub stars"
      },
      {
       "n": "366",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How Zustand is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "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%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "194 projects, 5.9%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "184 projects, 7.5%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "165 projects, 5.4%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "42 projects, 8.9%",
       "v": "Gemini CLI",
       "path": "agents/gemini-cli/"
      },
      {
       "l": "25 projects, 5.3%",
       "v": "OpenAI Codex",
       "path": "agents/openai-codex/"
      },
      {
       "l": "24 projects, 8.6%",
       "v": "Devin Desktop",
       "path": "agents/devin-desktop/"
      },
      {
       "l": "21 projects, 6.1%",
       "v": "OpenCode",
       "path": "agents/opencode/"
      },
      {
       "l": "15 projects, 10.7%",
       "v": "Kiro",
       "path": "agents/kiro/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 98.6% of its projects",
       "v": "React",
       "path": "tools/react/"
      },
      {
       "l": "In 68.0% of its projects",
       "v": "Lucide React",
       "path": "tools/lucide-react/"
      },
      {
       "l": "In 65.0% of its projects",
       "v": "clsx",
       "path": "tools/clsx/"
      },
      {
       "l": "In 84.7% of its projects",
       "v": "Tailwind CSS",
       "path": "tools/tailwindcss/"
      },
      {
       "l": "In 62.8% of its projects",
       "v": "Tailwind Merge",
       "path": "tools/tailwind-merge/"
      },
      {
       "l": "In 55.2% of its projects",
       "v": "Class Variance Authority",
       "path": "tools/class-variance-authority/"
      },
      {
       "l": "In 48.4% of its projects",
       "v": "Radix UI",
       "path": "tools/radix-ui/"
      },
      {
       "l": "In 80.1% of its projects",
       "v": "ESLint",
       "path": "tools/eslint/"
      }
     ]
    }
   ]
  },
  {
   "id": "profile",
   "nav": "Profile",
   "h2": "Zustand in practice",
   "parts": [
    {
     "t": "h3",
     "text": "Strengths"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "The store is a hook, no provider needed",
       "v": "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."
      },
      {
       "l": "Maintainers target known React pitfalls",
       "v": "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.\""
      },
      {
       "l": "Core runs without React",
       "v": "<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>."
      },
      {
       "l": "Transient updates skip re-renders",
       "v": "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."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Watch out for"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Render optimization is your job",
       "v": "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."
      },
      {
       "l": "Object selectors need useShallow",
       "v": "Change detection is strict equality by default. A selector that builds a new object or array needs <code>useShallow</code> to avoid unnecessary rerenders."
      },
      {
       "l": "Replace mode can delete your actions",
       "v": "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."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Create a store and bind components"
    },
    {
     "t": "tabs",
     "label": "Example",
     "items": [
      {
       "tab": "Jsx",
       "code": "import { create } from 'zustand'\n\nconst useBearStore = create((set) => ({\n  bears: 0,\n  increasePopulation: () => set((state) => ({ bears: state.bears + 1 })),\n  removeAllBears: () => set({ bears: 0 }),\n}))\n\nfunction BearCounter() {\n  const bears = useBearStore((state) => state.bears)\n  return <h1>{bears} around here ...</h1>\n}\n\nfunction Controls() {\n  const increasePopulation = useBearStore((state) => state.increasePopulation)\n  return <button onClick={increasePopulation}>one up</button>\n}"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "profile",
   "h2": "More about Zustand",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Funding",
       "path": "tools/funding/",
       "items": [
        "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"
       ]
      },
      {
       "title": "Agent Skills for it",
       "path": "skills/",
       "items": [
        "zustand-store-ts: Create Zustand stores with TypeScript, subscribeWithSelector middleware, and proper state/action separation. Use when building React state m"
       ]
      },
      {
       "title": "Packages around it",
       "items": [
        "react: UI library",
        "tailwindcss: Utility-first CSS",
        "clsx: className builder",
        "lucide-react: Icon components",
        "eslint: JS/TS linter",
        "tailwind-merge: Tailwind class merging"
       ]
      },
      {
       "title": "More in State and data fetching",
       "path": "tools/state-data/",
       "items": [
        {
         "text": "TanStack Query",
         "path": "tools/tanstack-react-query/"
        },
        {
         "text": "RxJS",
         "path": "tools/rxjs/"
        },
        {
         "text": "Pinia",
         "path": "tools/pinia/"
        },
        {
         "text": "SWR",
         "path": "tools/swr/"
        },
        {
         "text": "nuqs",
         "path": "tools/nuqs/"
        },
        {
         "text": "Immer",
         "path": "tools/immer/"
        },
        {
         "text": "React Redux",
         "path": "tools/react-redux/"
        },
        {
         "text": "Redux Toolkit",
         "path": "tools/reduxjs/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "Zustand",
       "me": true,
       "facts": [
        "MIT",
        "Gid 88",
        "96.9M/wk"
       ]
      },
      {
       "name": "Jotai",
       "why": "Minimal React state management with atoms as primitive building blocks for flexibility.",
       "path": "tools/jotai/",
       "facts": [
        "MIT",
        "Gid 72",
        "11M/wk"
       ]
      }
     ],
     "more": "Compare Zustand with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "install",
     "intro": "Install it.",
     "code": "npm install zustand"
    },
    {
     "t": "h3",
     "text": "Rules for your agent"
    },
    {
     "t": "rules",
     "label": "Paste into AGENTS.md or CLAUDE.md",
     "text": "## Zustand\n- 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.\n- When a selector returns a new object or array, wrap it in `useShallow` from `zustand/react/shallow`. The default comparison is strict equality.\n- 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.\n- For Map and Set values, create new instances on every update.\n- 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).\n- In TypeScript, write `create<State>()(...)` instead of `create(...)`.\n- 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.\n"
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm zustand"
  ],
  [
   "Category",
   "State and data fetching"
  ],
  [
   "License",
   "MIT"
  ],
  [
   "Latest version",
   "v5.0.15, August 13, 2026"
  ],
  [
   "On GitHub since",
   "April 2019"
  ],
  [
   "Gid Score",
   "88.3"
  ],
  [
   "Rank in category",
   "#2 of 53"
  ],
  [
   "GitHub",
   "pmndrs/zustand"
  ],
  [
   "Last change",
   "Nov 23, 2026"
  ]
 ],
 "good": [],
 "checked_line": "From the package registry, GitHub and our scan of public agent projects; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/pmndrs.png"
}