@but212/atom-effect
v0.25.0
Published
A reactive state management library that combines the power of `atom`, `computed`, and `effect` for seamless management of reactive state.
Downloads
584
Maintainers
Readme
@but212/atom-effect
Quick Start
Installation
npm install @but212/atom-effectUsage in 30 Seconds
import { atom, computed, effect } from '@but212/atom-effect';
// 1. Create State
const count = atom(0);
const multiplier = atom(2);
// 2. Derive State (Lazy & Cached)
const doubled = computed(() => count.value * multiplier.value);
// 3. React to Changes
const effectHandle = effect(() => {
console.log(`Count: ${count.value}, Doubled: ${doubled.value}`);
});
// Output: "Count: 0, Doubled: 0"
// 4. Update State
count.value = 1;
// Output: "Count: 1, Doubled: 2"
// 5. Cleanup
effectHandle.dispose();Documentation
- Onboarding Guide: Mental model, key concepts, and common pitfalls.
- API Reference: Detailed usage of
atom,computed,effect,batch,untracked. - Architecture: Deep dive into the epoch-based propagation system.
License
MIT © Jeongil Suk
