Skip to content

Commit

Permalink
Improve createReducer
Browse files Browse the repository at this point in the history
This change allows us to write reducers which depend on additional data as described here: reduxjs/redux#749 (comment)
  • Loading branch information
Mistereo committed Dec 6, 2015
1 parent 2966fa6 commit 2334af2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ export function createConstants (...constants) {
}

export function createReducer (initialState, fnMap) {
return (state = initialState, { type, payload }) => {
return (state = initialState, { type, payload }, ...rest) => {
const handler = fnMap[type];

return handler ? handler(state, payload) : state;
return handler ? handler(state, payload, ...rest) : state;
};
}

Expand Down

0 comments on commit 2334af2

Please sign in to comment.