Skip to content

atom

Creates a reactive state container.

import { atom } from '@reaxium/core';
function atom<T>(
initial: T,
storageFactory?: StorageFactory<T>
): Atom<T>
NameTypeDescription
initialTInitial value of the atom.
storageFactoryStorageFactory<T>(Optional) Storage system to persist the atom’s value. Defaults to memory.
TypeDescription
Atom<T>An atom instance.
const count = atom(0);