Skip to content

Latest commit

 

History

History
58 lines (36 loc) · 1.08 KB

File metadata and controls

58 lines (36 loc) · 1.08 KB
id injectSelector
title injectSelector

Function: injectSelector()

function injectSelector<TState, TSelected>(
   source, 
   selector, 
options?): Signal<TSelected>;

Defined in: packages/angular-store/src/injectSelector.ts:55

Selects a slice of state from an atom or store and returns it as an Angular signal.

This is the primary Angular read hook for TanStack Store.

Type Parameters

TState

TState

TSelected

TSelected = NoInfer<TState>

Parameters

source

SelectionSource<TState> | () => SelectionSource<TState>

selector

(state) => TSelected

options?

InjectSelectorOptions<TSelected>

Returns

Signal<TSelected>

Examples

readonly count = injectSelector(counterStore, (state) => state.count)
readonly doubled = injectSelector(countAtom, (value) => value * 2)