Open History to see the last commit
function useAtom<TValue>(atom, options?): [{
current: TValue;
}, (fn) => void & (value) => void];
Defined in: node_modules/.pnpm/@tanstack+svelte-store@0.12.1_svelte@5.56.8_@typescript-eslint+types@8.66.0_/node_modules/@tanstack/svelte-store/dist/useAtom.d.ts:16
Returns the current atom holder together with a setter.
Use this when a component needs to both read and update the same writable atom.
Type Parameters#
TValue#
TValue
Parameters#
atom#
Atom<TValue>
options?#
UseSelectorOptions<TValue>
Returns#
[{
current: TValue;
}, (fn) => void & (value) => void]
Example#
const [count, setCount] = useAtom(countAtom)
setCount((prev) => prev + 1)
console.log(count.current)