Skip to content

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 ParameterDefault type
TStateany
  • Store<TState>

new ZustandAdapter<TState>(initialState): ZustandAdapter<TState>

Defined in: index.ts:33

ParameterType
initialStateTState

ZustandAdapter<TState>

dispatch(action): void

Defined in: index.ts:126

Dispatch an action to update state

ParameterType
actionAction

void

Store.dispatch


getState(): TState

Defined in: index.ts:97

Get the current state

TState

Store.getState


subscribe(listener): () => void

Defined in: index.ts:107

Subscribe to state changes Returns an unsubscribe function

ParameterType
listener(state) => void

() => void

Store.subscribe