Skip to content

Documentation / @super-store/react / useStore

Function: useStore() ​

useStore<T>(store): InferStoreValueSnapshot<T>

Defined in: index.ts:11

Subscribe a component to a StoreValue. Returns the resolved snapshot (nested StoreValue children unwrapped to their values) and re-renders on change. The store's subscribe/getSnapshot are pre-bound, so this is a thin, tear-free wrapper over useSyncExternalStore.

Type Parameters ​

T ​

T

Parameters ​

store ​

StoreValue<T>

Returns ​

InferStoreValueSnapshot<T>

Released under the MIT License.