Skip to content

Instantly share code, notes, and snippets.

@josephajibodu
Last active December 26, 2021 19:06
Show Gist options
  • Save josephajibodu/5d70aca5242f4e10877f5248dc012eac to your computer and use it in GitHub Desktop.
Save josephajibodu/5d70aca5242f4e10877f5248dc012eac to your computer and use it in GitHub Desktop.
const logger => store => next => action => {
console.log("Logging", param)
next(action)
}
export default logger;
// This is how our logger middleware will look like without arrow functions
const logger = function(store) {
return function(next) {
return function(action) {
console.log("Logging", param)
next(action)
}
}
}
// This type of function will be called like this
// logger(store)(next)(action)
// Instead of logger(store, next, action)
// See my article on currying to understand this better.
export default logger;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment