mori-redux
Install instructions
cd
into your project directory- run
npm install --save mori-redux
Usage
createReduce
// import the goodies we like to use from mori// import the goodies we like to use from mori-redux // setup some state to begin withconst initialState = // along with the initialState we provide a hashMap with actionHandlers keyed by action-typesconst reducer = // for simplicity I wont hassle with setting up a store// lets give our reducer an action which is a plain javascript object const changedState = changedState // (2, 3, 4) // we can also use a hashMap as action like thisconst changedAgain =
combineReducers
// import mori stuff// import the combineReducer function// and for convience the createReducer function // let's quickly setup 2 reducers const lightSwitch = const counter = // Now we combine the reducersconst reducer = // Lets make use of themconst changedState = changedState // {'light' true, 'counter' 0} const changedAgain = changedAgain // {'light' true, 'counter' 1}
logMiddleware
// Import our middleware// Import the Redux stuff we need // Lets mockup a reducerconst reducer = 'state' // Apply the middleware when creating the storeconst store = // It's done, whenever the state change, it will log the state (in a human readable way)
Todos
There will be more goodies in the future, keep track of you favorite functionality by subscribing to the related issue.
Contributors
- Frank van Vuuren frank@dynngroup.com