UNPKG

jotai

Version:

👻 Primitive and flexible state management for React

11 lines (10 loc) • 325 B
'use client'; import { useAtomValue } from './useAtomValue.js'; import { useSetAtom } from './useSetAtom.js'; export function useAtom(atom, options) { return [ useAtomValue(atom, options), // We do wrong type assertion here, which results in throwing an error. useSetAtom(atom, options), ]; }