This repository was archived by the owner on Jan 23, 2019. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork1
Strongly-typed collection of tools to make your Redux workflow more dynamic.
License
NotificationsYou must be signed in to change notification settings
kettanaito/redux-dynamics
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Strongly-typed collection of useful tools to make yourRedux workflow more dynamic.
- No huge
switchstatements! stateis always immutableactionis always immutablecontextshared between all subscriptions- Declarative reducer subscriptions to the actions
- Encouraging pure resolver functions
- Support of
RegExpas the expected action type
npm install redux-dynamics --save
yarn add redux-dynamics
// ./store/comments/index.jsimport{Reducer}from'redux-dynamics';/* Create a new reducer with initial state */constreducer=newReducer({likes:0});/* Subscribe to different actions */reducer.subscribe('ADD_LIKE',(state,action,context)=>{/* Note how both "state" and "action" are immutable */constnextLikes=state.get('likes')+action.get('amount');/* Resolve the next state */returnstate.set('likes',nextLikes);});reducer.subscribe('ACTION_TYPE',(state,action,context)=>state);exportdefaultreducer;
// ./store/reducer.jsimport{createReducer}from'redux';importcommentsReducerfrom'./comments';exportdefaultcreateReducer({/* Convert "Reducer" class into pure reducer function */comments:commentsReducer.toFunction()});
For more details on methods, usage examples and troubleshootingsee the Documentation.
Feel free to submit your ideas on enhanced Redux workflow by issuing aPull request.
In case you have discovered a bug, outdated documentation or any other mismatch, pleasecreate a new Issue.
This library is licensed underMIT license.
About
Strongly-typed collection of tools to make your Redux workflow more dynamic.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.