function useSelector<TSource, TSelected>(
source,
selector?,
options?): TSelected;Defined in: node_modules/.pnpm/@tanstack+preact-store@0.13.1_preact@10.29.2/node_modules/@tanstack/preact-store/dist/useSelector.d.ts:29
Selects a slice of state from an atom or store and subscribes the component to that selection.
This is the primary Preact read hook for TanStack Store. Use it when a component only needs part of a source value, or omit the selector to subscribe to the whole value.
TSource
TSelected = NoInfer<TSource>
SelectionSource<TSource>
(snapshot) => TSelected
UseSelectorOptions<TSelected>
TSelected
const count = useSelector(counterStore, (state) => state.count)const value = useSelector(countAtom)