Linex
Refined State Management, pronounced as /ˈlɪnəks/.
Installation
npm i linex
Features
- Read State (Selectors)
- Update State (Actions)
- Effortless Immutability
- Async Side-Effects
- Memoized Reads
- Plugins (Middleware)
- React Integration
- IE11 Support
- Reusable Stores
Standalone Usage
const store = // Statestorecount // => 0, store.count: 0// Updatestore // => 1, store.count: 1store // => 3, store.count: 3// Readstore // => 6// Memoized Read, only called once if props stay the same.store // => 6store // => 6, but from cache.// Async Updateconst value = await store // store.count: 4, value: 4
Usage with React
Comes with built-in helpers for React integration.
const store = { const count increment = thisstate return <div> <p>count</p> <button onClick= >Increment</button> </div> } const mapStore = count: storecount increment: storeincrement
Nested Stores
It's possible to split up sub-parts of the state into separate stores. The last call to create automatically denotes the root store that can be accessed from anywhere with get().
const store = storenestedcount // => 1nestedcount // => 1