import { type PrimitiveAtom, useAtom } from "jotai" export function WithAtom({ atom, children, }: { atom: PrimitiveAtom children: ( value: Value, setValue: (value: Value | ((current: Value) => Value)) => void, ) => React.ReactNode }) { const [value, setValue] = useAtom(atom) return children(value, setValue) }