Skip to content

Instantly share code, notes, and snippets.

@treyhuffine
Created August 10, 2017 13:41
Show Gist options
  • Save treyhuffine/d28aa062e350506194241f3bf3967ae5 to your computer and use it in GitHub Desktop.
Save treyhuffine/d28aa062e350506194241f3bf3967ae5 to your computer and use it in GitHub Desktop.
/**
* Logs all actions and states after they are dispatched.
*/
const logger = function(store) {
return function(next) {
return function(action) {
console.group(action.type)
console.info('dispatching', action)
let result = next(action)
console.log('next state', store.getState())
console.groupEnd(action.type)
return result
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment