function injectAtom<TValue>(atom, options?): WritableAtomSignal<TValue>;
function injectAtom<TValue>(atom, options?): WritableAtomSignal<TValue>;
Defined in: packages/angular-store/src/injectAtom.ts:44
Returns a WritableAtomSignal that reads the current atom value when called and exposes a .set method for updates.
Use this when a component needs to both read and update the same writable atom.
TValue
Atom<TValue>
InjectSelectorOptions<TValue>
WritableAtomSignal<TValue>
readonly count = injectAtom(countAtom)
increment() {
this.count.set((prev) => prev + 1)
}
readonly count = injectAtom(countAtom)
increment() {
this.count.set((prev) => prev + 1)
}
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.