Skip to content

Instantly share code, notes, and snippets.

@csantiago132
Last active February 25, 2020 00:43
Show Gist options
  • Select an option

  • Save csantiago132/0d2bc0b5e18fce613d70a6232f5ca42e to your computer and use it in GitHub Desktop.

Select an option

Save csantiago132/0d2bc0b5e18fce613d70a6232f5ca42e to your computer and use it in GitHub Desktop.
// ... prev. code ommited
export const combineReducer = (reducers) => {
// ... prev. code ommited
/**
* Global reducer function; this is passed to the useReducer hook
*
* @param {object} state
* @param {object} action
*/
const reducerFunction = (state, action) => {
// used to compare prevState vs the one returned by the reducer
let hasStateChanged = false;
// updated state object to be returned
const updatedStateByReducers = {};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment