ZustandAdapter
Defined in: index.ts:20
Zustand adapter. zustand is a peer dependency and is statically
imported — so construction is synchronous and SSR-friendly. The async
helpers below stay for back-compat with consumers that already wrote
await createZustandStore(...); they resolve immediately.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
TState | any |
Implements
Section titled “Implements”Store<TState>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ZustandAdapter<
TState>(initialState):ZustandAdapter<TState>
Defined in: index.ts:33
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
initialState | TState |
Returns
Section titled “Returns”ZustandAdapter<TState>
Methods
Section titled “Methods”dispatch()
Section titled “dispatch()”dispatch(
action):void
Defined in: index.ts:126
Dispatch an action to update state
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
action | Action |
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Store.dispatch
getState()
Section titled “getState()”getState():
TState
Defined in: index.ts:97
Get the current state
Returns
Section titled “Returns”TState
Implementation of
Section titled “Implementation of”Store.getState
subscribe()
Section titled “subscribe()”subscribe(
listener): () =>void
Defined in: index.ts:107
Subscribe to state changes Returns an unsubscribe function
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
listener | (state) => void |
Returns
Section titled “Returns”() => void
Implementation of
Section titled “Implementation of”Store.subscribe