- useStoreContext<
TArgs extends unknown[],
TState extends object,
TActions extends object,
TSelection = TState,
>(
storeContext: StoreContext<TArgs, TState, TActions>,
select?: (state: TState) => TSelection,
): BoundStore<TState, TActions, TSelection> Type Parameters
- TArgs extends unknown[]
- TState extends object
- TActions extends object
- TSelection = TState
The store instance.
A hook used to access a store context created with
createStoreContext
.Example
Basic usage:
Example
With a select function:
Remarks
If the
select
function is provided, an equality check is performed. This has some caveats:state.count
){ count: state.count }
)