Skip to content

Instantly share code, notes, and snippets.

@NetanelBasal
Last active June 18, 2020 11:57
Show Gist options
  • Save NetanelBasal/7528d7128d0c806308eca1d2d49d26c5 to your computer and use it in GitHub Desktop.
Save NetanelBasal/7528d7128d0c806308eca1d2d49d26c5 to your computer and use it in GitHub Desktop.
export function logger( reducer ) {
return function newReducer( state, action ) {
console.group(action.type);
const nextState = reducer(currentState, action);
console.log(`%c prev state`, `color: #9E9E9E; font-weight: bold`, state);
console.log(`%c action`, `color: #03A9F4; font-weight: bold`, action);
console.log(`%c next state`, `color: #4CAF50; font-weight: bold`, nextState);
console.groupEnd();
return nextState;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment