Feature Store
Feature Stores offer simple yet powerful (global) state management.
Key Principles
- Less Boilerplate: With the
FeatureStore
API you can update state without writing actions and reducers - A Feature Store manages feature state directly
- The state of a Feature Store integrates into the global state
- Feature Stores are destroyable
What's Included
The MiniRx FeatureStore
API:
setState()
update the feature statesetInitialState()
initialize feature state lazilyselect()
select state from the feature state object as RxJS Observableeffect()
run side effects like API calls and update feature stateundo()
easily undo setState actions (requires the UndoExtension)destroy()
remove the feature state from the global state objecttapResponse
operator: handle the response in Feature Storeeffect
consistently and with less boilerplate
info
How the Feature Store works
Feature Stores make use of Redux too: Behind the scenes a Feature Store is creating a feature reducer and a "setState" action. MiniRx dispatches that action when calling setState()
and the corresponding feature reducer will update the feature state accordingly.