Skip to content

Commit

Permalink
naming
Browse files Browse the repository at this point in the history
  • Loading branch information
rwieruch committed May 13, 2019
1 parent e10795e commit 907b387
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,17 @@ const todoReducer = (state, action) => {
}
};

const useCombinedReducer = useReducers => {
const useCombinedReducer = combinedReducers => {
// Global State
const state = Object.keys(useReducers).reduce(
(acc, key) => ({ ...acc, [key]: useReducers[key][0] }),
const state = Object.keys(combinedReducers).reduce(
(acc, key) => ({ ...acc, [key]: combinedReducers[key][0] }),
{}
);

// Global Dispatch Function
const dispatch = action =>
Object.keys(useReducers)
.map(key => useReducers[key][1])
Object.keys(combinedReducers)
.map(key => combinedReducers[key][1])
.forEach(fn => fn(action));

return [state, dispatch];
Expand Down

0 comments on commit 907b387

Please sign in to comment.