Open History to see the last commit
1---
2id: useAtom
3title: useAtom
4---
5β
6```ts
7function useAtom<TValue>(atom, options?): [TValue, (fn) => void & (value) => void];
8```
9β
10Defined in: node\_modules/.pnpm/@tanstack+react-store@0.11.0\_react-dom@19.2.8\_react@19.2.8\_\_react@19.2.8/node\_modules/@tanstack/react-store/dist/useAtom.d.ts:16
11β
12Returns the current atom value together with a stable setter.
13β
14This is the writable-atom convenience hook for components that need to both
15read and update the same atom.
16β
17## Type Parameters
18β
19### TValue
20β
21`TValue`
22β
23## Parameters
24β
25### atom
26β
27[`Atom`](../interfaces/Atom.md)\<`TValue`\>
28β
29### options?
30β
31[`UseSelectorOptions`](../interfaces/UseSelectorOptions.md)\<`TValue`\>
32β
33## Returns
34β
35\[`TValue`, (`fn`) => `void` & (`value`) => `void`\]
36β
37## Example
38β
39```tsx
40const [count, setCount] = useAtom(countAtom)
41```