CodeVetter · Repo Unpack · Extension points
pmndrs/zustand
Extension centers on StateCreator factories and higher-order middleware rather than a runtime plugin loader. TypeScript module augmentation tracks how middleware changes StoreApi. Storage, selectors, comparators, reducers, slices, and exported entrypoints are the principal customization boundaries.
- StateCreator receives setState, getState, and store; createStore accepts that factory, allowing consumer-defined state and actions without a registry.
- StoreMutators is an augmentable interface, and Mutate recursively applies mutator tuples; middleware such as Immer registers its API transformation through module augmentation.
- PersistStorage is the storage extension contract, while createJSONStorage adapts string backends and exposes reviver/replacer hooks for custom serialization.
- PersistOptions separates partialize, migrate, merge, and onRehydrateStorage; each customizes a distinct write or hydration stage.
- useStore accepts an existing store and selector, while traditional hooks accept equality functions and subscribeWithSelector accepts comparator/immediate-delivery options.
- redux injects a caller-supplied reducer and initial state; combine injects a creator whose output overrides overlapping initial-state keys.
- The documented slices pattern combines factories through object spread and applies middleware to the combined store, explicitly discouraging middleware inside individual slices.
- DevtoolsOptions extends the extension connector configuration and adds name/store/enabled/action naming; new packaged source entrypoints must fit Rollup's config-flag routing and the package subpath export map.