Skip to content

Instantly share code, notes, and snippets.

@treyhuffine
Created August 10, 2017 13:34
Show Gist options
  • Save treyhuffine/1b36b803b9cba67f58855a5196622ee5 to your computer and use it in GitHub Desktop.
Save treyhuffine/1b36b803b9cba67f58855a5196622ee5 to your computer and use it in GitHub Desktop.
/**
* Logs all actions and states after they are dispatched.
*/
const logger = store => next => 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