redux中间件就是对dispatch进行处理,dispatch接收action creator后先进行处理后再讲action传给reducer

使用方法:
const createStoreWithMiddleware = applyMiddleware(
thunkMiddleware,
loggerMiddleware
)(createStore);
store = createStoreWithMiddleware(rootReducer, initialState);
执行过程:

编写middleware:
const customMiddleware = store => next => action => {
if(action.type !== ‘custom‘) return next(action)
//do stuff!
}
原文:http://www.cnblogs.com/lee1993/p/7155179.html