TanStackStore v0
Auto

StoreOptions

Interface: StoreOptions<TState, TUpdater>

Defined in: store.ts:4

Type Parameters

TState

TUpdater extends AnyUpdater = (cb) => TState

Properties

onSubscribe()?

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

Defined in: store.ts:17

Called when a listener subscribes to the store.

Parameters

listener

Listener<TState>

store

Store<TState, TUpdater>

Returns

Function

a function to unsubscribe the listener

Returns

void


onUpdate()?

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

Defined in: store.ts:24

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

Returns

void


updateFn()?

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

Defined in: store.ts:11

Replace the default update function with a custom one.

Parameters

previous

TState

Returns

Function

Parameters
updater

TUpdater

Returns

TState

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.