Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

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

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

Parameters

key: string
initialValue: Value
storage: AsyncStorage<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>