先說結論,什麼是Redux的中間件
簡單來說,就是一個接受dispatch函數並返回一個dispatch函數的函數
作用
對原來的dispatch函數進行增強,類似與java中的代理,對被代理的方法進行增強
重要特徵
可以被鏈式調用
典型案例
const logger = store => next => action {
console.info("dispatching", action);
let result = next(action);
console.info("state", store.getState());
return result;
}