function useCreateAtom<T>(getValue, options?): ReadonlyAtom<T>;
function useCreateAtom<T>(getValue, options?): ReadonlyAtom<T>;
Defined in: packages/react-store/src/useCreateAtom.ts:17
Creates a stable atom instance for the lifetime of the component.
Pass an initial value to create a writable atom, or a getter function to create a readonly derived atom. This hook mirrors the overloads from createAtom, but ensures the atom is only created once per mount.
T
(prev?) => T
AtomOptions<T>
ReadonlyAtom<T>
const countAtom = useCreateAtom(0)
const countAtom = useCreateAtom(0)
function useCreateAtom<T>(initialValue, options?): Atom<T>;
function useCreateAtom<T>(initialValue, options?): Atom<T>;
Defined in: packages/react-store/src/useCreateAtom.ts:21
Creates a stable atom instance for the lifetime of the component.
Pass an initial value to create a writable atom, or a getter function to create a readonly derived atom. This hook mirrors the overloads from createAtom, but ensures the atom is only created once per mount.
T
T
AtomOptions<T>
Atom<T>
const countAtom = useCreateAtom(0)
const countAtom = useCreateAtom(0)
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.