标签:中间 with font 16px reducer custom size logs store
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!
}
标签:中间 with font 16px reducer custom size logs store
原文地址:http://www.cnblogs.com/lee1993/p/7155179.html