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

x/jotai/src/core/atom.ts>atom

👻 Primitive and flexible state management for React
Go to Latest
function atom
import { atom } from "https://deno.land/x/jotai@v1.8.3/src/core/atom.ts";

Type Parameters

Value
Update
optional
Result extends void | Promise<void> = void

Parameters

read: Read<Value>
write: Write<Update, Result>

Parameters

invalidFunction: (...args: any) => any
optional
write: any

Returns

never

Type Parameters

Value
Update
optional
Result extends void | Promise<void> = void

Parameters

initialValue: Value
write: Write<Update, Result>

Parameters

initialValue: Value

Returns

PrimitiveAtom<Value> & WithInitialValue<Value>