how to write middleware redux code example
Example 1: redux middleware
A Redux middleware is a function returning a function, which takes next as a
parameter. Then the inner function returns another function which takes action
as a parameter and finally returns next(action). Here's how it looks like:
function Middleware() {
return function(next){
return function(action){
return next(action);
}
}
}
Example 2: react redux middleware
const loggingMiddleware = function(store) {
return function(next) {
return function(action) {
}
}
}