create-redux-reducer-from-map
My personal preference for eliminating the Redux switch statements
Last updated 5 years ago by tehshrike .
WTFPL · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install create-redux-reducer-from-map 
SYNC missed versions from official npm registry.

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 an map of action types to functions taking (state, action).

License

WTFPL

Current Tags

  • 1.0.0                                ...           latest (5 years ago)

1 Versions

  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (1)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |