Last active
December 26, 2021 19:06
-
-
Save josephajibodu/5d70aca5242f4e10877f5248dc012eac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const logger => store => next => action => { | |
console.log("Logging", param) | |
next(action) | |
} | |
export default logger; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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