Skip to content

Commit

Permalink
Merge pull request redux-utilities#63 from contra/patch-2
Browse files Browse the repository at this point in the history
only create reducer function one time
  • Loading branch information
acdlite committed Feb 7, 2016
2 parents 1754efc + 8762369 commit aa0445b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/handleActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ export default function handleActions(handlers, defaultState) {
const reducers = ownKeys(handlers).map(type => {
return handleAction(type, handlers[type]);
});
const reducer = reduceReducers(...reducers)

return typeof defaultState !== 'undefined'
? (state = defaultState, action) => reduceReducers(...reducers)(state, action)
: reduceReducers(...reducers);
? (state = defaultState, action) => reducer(state, action)
: reducer;
}

0 comments on commit aa0445b

Please sign in to comment.