Quick Start
Get up and running with Reaxium in minutes.
1. Install Reaxium
Section titled “1. Install Reaxium”npm install @reaxium/core
pnpm add @reaxium/core
yarn add @reaxium/core
bun add @reaxium/core
2. Create Your First Atom
Section titled “2. Create Your First Atom”import { atom } from '@reaxium/core';
const count = atom(0);
console.log(count.get()); // 0count.set(1);console.log(count.get()); // 1
3. Subscribe to Changes
Section titled “3. Subscribe to Changes”const unsubscribe = count.subscribe((value) => { console.log('Count changed:', value);});// Output: "Count changed: 1"count.set(2); // Output: "Count changed: 2"unsubscribe();
4. Create a Computed Value
Section titled “4. Create a Computed Value”import { computed } from '@reaxium/core';
const double = computed(() => count.get() * 2, [count]);
console.log(double.get()); // 4count.set(3);console.log(double.get()); // 6
5. Watch for Side Effects
Section titled “5. Watch for Side Effects”import { watch } from '@reaxium/core';
watch(count, (value) => { console.log('New count:', value);});// Output: "New count: 3"