| id | TanStackStoreAtom |
|---|---|
| title | TanStackStoreAtom |
Defined in: tan-stack-store-atom.ts:29
Subscribes a Lit host to a writable atom and exposes its current value along with a stable setter.
Use this when an element needs to both read and update the same writable
atom. The host will only re-render when the atom's value actually changes
(according to the configured compare function).
class CounterEl extends LitElement {
`#count` = new TanStackStoreAtom(this, () => countAtom)
render() {
return html`
<button @click=${() => this.#count.set((prev) => prev + 1)}>
${this.#count.value}
</button>
`
}
}TValue
new TanStackStoreAtom<TValue>(
host,
getAtom,
options?): TanStackStoreAtom<TValue>;Defined in: tan-stack-store-atom.ts:32
ReactiveControllerHost
() => Atom<TValue> | undefined
UseSelectorOptions<TValue>
TanStackStoreAtom<TValue>
get value(): TValue | undefined;Defined in: tan-stack-store-atom.ts:43
TValue | undefined
set(value): void;Defined in: tan-stack-store-atom.ts:47
TValue
void
set(updater): void;Defined in: tan-stack-store-atom.ts:48
(prev) => TValue
void