function useAtom<TValue>(atom, options?): [{
current: TValue;
}, (fn) => void & (value) => void];function useAtom<TValue>(atom, options?): [{
current: TValue;
}, (fn) => void & (value) => void];Defined in: svelte-store/src/useAtom.ts:18
Returns the current atom holder together with a setter.
Use this when a component needs to both read and update the same writable atom.
TValue
Atom<TValue>
UseSelectorOptions<TValue>
[{ current: TValue; }, (fn) => void & (value) => void]
const [count, setCount] = useAtom(countAtom)
setCount((prev) => prev + 1)
console.log(count.current)const [count, setCount] = useAtom(countAtom)
setCount((prev) => prev + 1)
console.log(count.current)