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

x/jotai/src/vanilla.ts>atom

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

Type Parameters

Value
Args extends unknown[]
Result

Parameters

read: Read<Value, SetAtom<Args, Result>>
write: Write<Args, Result>

Type Parameters

Value
Args extends unknown[]
Result

Parameters

initialValue: Value
write: Write<Args, Result>

Returns

WritableAtom<Value, Args, Result> & WithInitialValue<Value>

Returns

PrimitiveAtom<Value | undefined> & WithInitialValue<Value | undefined>

Parameters

initialValue: Value

Returns

PrimitiveAtom<Value> & WithInitialValue<Value>