# Introduction

Zustand is a state-management library for developers building React applications or using stores outside React. A store holds state independently of React; a bound hook lets your components select the values they need without a context provider. Start with state and actions, then add persistence, debugging, or other middleware when your application needs them.

## Package and entry points

`zustand` provides the stores, React bindings, and middleware described below. Install it in your project:

```bash
npm install zustand
```

These are entry points of the same package, not separate packages to install. Follow each reference link for its exports, types, and signatures.

| Entry point | What it provides |
| --- | --- |
| [`zustand`](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/zustand) | The core store API and React bindings together. |
| [`zustand/vanilla`](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/zustand-vanilla) | Standalone stores with imperative reads, updates, and subscriptions, without importing React. |
| [`zustand/react`](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/zustand-react) | React hooks for creating bound stores and subscribing to vanilla stores. |
| [`zustand/middleware`](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/zustand-middleware) | Middleware for persistence, Redux DevTools, reducer-based actions, inferred state, and selector subscriptions. |
| [`zustand/react/shallow`](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/zustand-react-shallow) | A React selector helper that retains a previous result when the new result is shallowly equal. |
| [`zustand/vanilla/shallow`](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/zustand-vanilla-shallow) | Shallow comparison without importing React. |
| [`zustand/shallow`](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/zustand-shallow) | Both the shallow comparator and the React selector helper. |
| [`zustand/traditional`](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/zustand-traditional) | React bindings that accept custom equality functions; these use the additional `use-sync-external-store` package. |
| [`zustand/middleware/immer`](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/zustand-middleware-immer) | Draft-based state updates using the additional `immer` package. |

The guides for custom equality and Immer include the additional installation commands for those integrations.

## Start with React

Take the [React quick start](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/react-quick-start) to install Zustand and build a typed counter with an action and component selectors. If you need a store outside React, read [Stores and React bindings](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/store-and-react-binding) to distinguish the standalone store from its React hook.

## Find your task

### Concepts

[How Zustand works](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/how-zustand-works) connects independent stores, immutable updates, selector subscriptions, and actions; continue with [Stores and React bindings](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/store-and-react-binding), [Immutable state and merging](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/immutable-state-and-merging), and [Selectors and rendering](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/selectors-and-rendering) for the details that shape your code.

### Guides

- **Editing state:** [Update and reset state](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/update-and-reset-state), work with [Maps and Sets](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/update-maps-and-sets) or [Immer drafts](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/update-state-with-immer), and [organize actions](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/organize-store-actions); the [tic-tac-toe tutorial](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/build-tic-tac-toe) puts shared state and time travel into a playable interface.
- **Structuring stores:** [Type stores and selectors](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/type-stores-and-selectors), then [split a growing store into slices](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/split-store-into-slices) while keeping a combined store.
- **Subscribing and rendering:** [Select computed state](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/select-computed-state) and [customize equality checks and subscriptions](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/customize-equality-and-subscriptions) to control which changes your components and imperative listeners observe.
- **Saving and restoring:** [Persist store state](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/persist-store-state), [control hydration](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/control-persisted-state-hydration), [migrate saved data](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/migrate-persisted-data), or [synchronize state with the URL](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/sync-state-with-url).
- **Scoping and server rendering:** [Scope stores with context](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/scope-stores-with-context) for isolated component trees and [server-render React stores](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/server-render-react-stores) with per-request ownership and matching initial state.
- **Debugging and maintenance:** [Inspect actions with Redux DevTools](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/debug-store-actions), [test stores and components](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/test-stores-and-components), and [migrate existing stores to v5](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/migrate-stores-to-v5).
- **Extending:** [Implement custom storage](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/implement-custom-storage) or [write typed middleware](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/write-typed-middleware) when the shipped integrations do not meet your requirements.

### API reference

Use the entry-point references above when you need an exact signature, type, or option rather than a task walkthrough: start with the [core package](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/zustand) for stores and React hooks, or [middleware](https://bench-zustand-61.atloria.app/p/bench-zustand-61-pSJCWrWW5Y/developer/zustand-middleware) for composable store behavior.
