Install Legend-State
Install Legend-State using your preferred package manager:Package Exports
Legend-State provides several entry points for different use cases:Core State Management
observable- Create observable stateobserve- React to state changescomputed- Create computed observablesbatch- Batch multiple changeswhen- Wait for conditions- Helper functions and utilities
React Integration
observer- HOC for reactive componentsuseObservable- Create local observable stateuseSelector- Subscribe to observable changesuseObserve- Run side effects on changesMemo,Show,For,Switch- Reactive componentsReactive- Make any component reactive
Sync & Persistence
- Keel
- Supabase
- TanStack Query
- Firebase
- Fetch API
Local Persistence
- Local Storage (browser)
- IndexedDB (browser)
- AsyncStorage (React Native)
- MMKV (React Native)
Requirements
Legend-State has minimal requirements:- Node.js: >= 16.6.0
- npm: >= 8.11.0
- React (optional): >= 16.8.0 for hooks support
Legend-State works in any JavaScript environment. React is only required if you’re using the React integration features.
TypeScript Support
Legend-State is written in TypeScript and includes full type definitions out of the box. No additional@types packages are needed.
Next Steps
Quickstart Guide
Build your first app with Legend-State in minutes.
Core Concepts
Learn about observables and how to use them.
React Integration
Integrate Legend-State with your React applications.
Sync & Persistence
Set up data synchronization and local persistence.