StoreOptions

Interface: StoreOptions<TState, TUpdater>

Type Parameters

TState

TUpdater extends AnyUpdater = (cb) => TState

Properties

onSubscribe()?

ts
optional onSubscribe: (listener, store) => () => void;
optional onSubscribe: (listener, store) => () => void;

Called when a listener subscribes to the store.

Parameters

listener

Listener

store

Store<TState, TUpdater>

Returns

Function

a function to unsubscribe the listener

Returns

void

Defined in

index.ts:24


onUpdate()?

ts
optional onUpdate: () => void;
optional onUpdate: () => void;

Called after the state has been updated, used to derive other state.

Returns

void

Defined in

index.ts:31


updateFn()?

ts
optional updateFn: (previous) => (updater) => TState;
optional updateFn: (previous) => (updater) => TState;

Replace the default update function with a custom one.

Parameters

previous

TState

Returns

Function

Parameters
updater

TUpdater

Returns

TState

Defined in

index.ts:18

Subscribe to Bytes

Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.

Bytes

No spam. Unsubscribe at any time.