Skip to main content
Module

x/jotai/docs/utils/use-atom-value.mdx

👻 Primitive and flexible state management for React
Go to Latest
File
---title: useAtomValuepublished: false---
Ref: https://github.com/pmndrs/jotai/issues/212
```jsximport { atom, Provider, useAtom } from 'jotai'import { useAtomValue } from 'jotai/utils'
const countAtom = atom(0)
const Counter = () => { const setCount = useUpdateAtom(countAtom) const count = useAtomValue(countAtom) return ( <> <div>count: {count}</div> <button onClick={() => setCount(count + 1)}>+1</button> </> )}```
<CodeSandbox id="1x90m" />