Skip to content

Documentation / @super-store/react / useStoreSelector

Function: useStoreSelector() ​

useStoreSelector<T, R>(store, selector, isEqual?): R

Defined in: index.ts:22

Subscribe to a projection of a StoreValue. The component only re-renders when selector(snapshot) changes under isEqual (default Object.is), even though the store emits on every change. Pass a stable selector (or accept that an inline selector recomputes each render — the equality check still prevents the re-render).

Type Parameters ​

T ​

T

R ​

R

Parameters ​

store ​

StoreValue<T>

selector ​

(snapshot) => R

isEqual? ​

(a, b) => boolean

Returns ​

R

Released under the MIT License.