function useSelector<TSource, TSelected>(
source,
selector,
options?): Readonly<Ref<TSelected>>;function useSelector<TSource, TSelected>(
source,
selector,
options?): Readonly<Ref<TSelected>>;Defined in: vue-store/src/useSelector.ts:39
Selects a slice of state from an atom or store and subscribes the component to that selection.
This is the primary Vue read hook for TanStack Store. It returns a readonly ref containing the selected value.
Omit the selector to subscribe to the whole value.
TSource
TSelected = NoInfer<TSource>
SelectionSource<TSource>
(snapshot) => TSelected
UseSelectorOptions<TSelected>
Readonly<Ref<TSelected>>
const count = useSelector(counterStore, (state) => state.count)
console.log(count.value)const count = useSelector(counterStore, (state) => state.count)
console.log(count.value)const value = useSelector(countAtom)const value = useSelector(countAtom)