Skip to content

Instantly share code, notes, and snippets.

@ustun ustun/todoappreducer8.js Secret
Last active Feb 8, 2017

What would you like to do?
function reducerFromRecordClass(klass) {
return function todoAppReducer(state=new klass(), action) {
var fn = state[camelcase(action.type)]
if (fn) {
return state[camelcase(action.payload)](action);
} else {
// we don’t recognize the method, return current state.
return state;
todoReducer = reducerFromRecordClass(Todo)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.