My personal preference for eliminating the Redux switch statements
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
.travis.yml
index.js
package.json
readme.md
test.js

readme.md

My own personal preference for building reducers for Redux.

var makeReducer = require('create-redux-reducer-from-map')

const arithmeticReducer = makeReducer({
	ADD: (state, action) => state + action.payload,
	SUBTRACT: (state, action) => state - action.payload
}, 0)

makeReducer(mapOfFunctions[, initialState])

Returns a reducer appropriate for Redux. Takes a map of action types to functions taking (state, action).

License

WTFPL