F

useStore

Selects state from Flux stores in a component, re-rendering only when the selection changes.

function useStore<S extends FluxStore | readonly FluxStore[], T>(stores: S, selector: (stores: S) => T, options?: UseStoreOptions<T>): T

Parameters

NameTypeDescription
storesS

The store, or stores, the selector reads.

selector(stores: S) => T

Reads the value from the stores, which it receives as passed.

options?UseStoreOptions<T>

The selector's deps, and the isEqual that compares two selections.

Returns

T

The selector's latest value.