Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/jotai/src/vanilla/utils/atomWithStorage.ts>atomWithStorage

👻 Primitive and flexible state management for React
Go to Latest
function atomWithStorage
import { atomWithStorage } from "https://deno.land/x/jotai@v2.6.5/src/vanilla/utils/atomWithStorage.ts";

Parameters

key: string
initialValue: Value
optional
options: { getOnInit?: boolean; }

Returns

WritableAtom<Value | Promise<Value>, [SetStateActionWithReset<Value | Promise<Value>>], Promise<void>>

Parameters

key: string
initialValue: Value
optional
storage: SyncStorage<Value>
optional
options: { getOnInit?: boolean; }

Returns

WritableAtom<Value, [SetStateActionWithReset<Value>], void>