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

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

👻 Primitive and flexible state management for React
Go to Latest
function atom
import { atom } from "https://deno.land/x/jotai@v2.9.1/src/vanilla/atom.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>