§ 总结
Redux 有五个 API,分别是:
createStore(reducer, [initialState])
combineReducers(reducers)
applyMiddleware(...middlewares)
bindActionCreators(actionCreators, dispatch)
compose(...functions)
createStore
生成的 store
有四个 API,分别是:
getState()
dispatch(action)
subscribe(listener)
replaceReducer(nextReducer)
至此,若您已经理解上述 API 的作用机理,以及中间件与增强器的概念/区别
本人将不胜荣幸,不妨点个 [star][this-github] 算是对我的赞赏
如您对本教程有任何意见或改进的建议,欢迎 [issue][this-issue],我会尽快予您答复
最后奉上 React + Redux + React Router 的简易留言板实例:[react-demo][react-demo]
拓展阅读:[中间件的洋葱模型][middleware-onion-model]