state-ref
- Universal state management library focused on data immutability
- Combines proxies and functional programming lens pattern for efficient state management
- Provides fine-grained control over deeply structured data
- Designed for easy integration with UI frameworks including Svelte, React, Preact, Vue, Solid, and Lithent
Key Features
- Immutable state management with
.valueaccess pattern - Subscription system that only reacts to accessed values
- Supports primitive types and complex nested objects
- Flux-like state management option via
createStoreManualSync - Framework-specific connectors available as separate packages
Framework Support
- Svelte: Returns Svelte Writable stores synchronized with state
- React/Preact: Direct stateRef access in components
- Vue: Returns Vue Reactive objects
- Solid: Returns Solid Signals
- Lithent: Works directly without connector
Target Audience
- Developers needing immutable state management
- Projects using multiple frameworks that could benefit from shared state logic
- Teams requiring fine-grained control over state updates
Implementation Highlights
- Uses
copyOnWritepattern for safe state modifications - Provides
copyablehelper for object state management - Supports both direct updates and centralized Flux-like patterns
Links:
preactreactsolidjsstatestoresveltevue
Featured Stories
No featured articles.