# useAtom

# Function: useAtom()

```ts
function useAtom<TValue>(
  atom,
  options?,
): [TValue, Atom<TValue>['set']];
```

Defined in: [octane-store/src/useAtom.ts:17](https://github.com/TanStack/store/blob/main/packages/octane-store/src/useAtom.ts#L17)

Returns the current atom value together with a stable setter.

This is the writable-atom convenience hook for components that need to both
read and update the same atom.

## Type Parameters

### TValue

`TValue`

## Parameters

### atom

`Atom`\<`TValue`\>

### options?

[`UseSelectorOptions`](../interfaces/UseSelectorOptions.md)\<`TValue`\>

## Returns

\[`TValue`, `Atom`\<`TValue`\>\[`"set"`\]\]

## Example

```tsx
const [count, setCount] = useAtom(countAtom)
```
