What is Redux-Sword
Redux-Sword
is a tool for Redux Reducer
, which can make it automatically processed, so you can code less with it.
Installation
To install the stable version:
npm install --save-dev redux-sword
How to Use?
reducer's definition
const initailStateMain = userName: '' userNick: '' isLogined: false; const initailStateProject = projectId: 0 projectName: ''; const reducers = ; ;
dispatch useage
;
More
index.js
for combine reducers
// Here is the magic function// 'main' or 'project' is your reducer //Use equipSword to make your reducer map a auto reducer map.//You need keep 'main' and 'project' reducer to keep the different names.//Here 'main' reducer with name 'main', 'project' reducer with name 'project', so, it's ok.const reducers = ; ;
main.js
reducer
const initailState = userName: '' userNick: '' isLogined: false; { };
dispatch useage
;
License
MIT