通过 createStore 方法创建的 store 是一个对象,它本身又包含4个方法:
getState() :
获取 store 中当前的状态。
dispatch(action):
分发一个 action,并返回这个 action,这是唯一能改变 store 中数据的方式。
subscribe(listener):
注册一个监听者,它在 store 发生变化时被调用。
replaceReducer(nextReducer):
更新当前的 store 里的 reducer ,一般只会在开发模式中调用该方法。
详解react、redux、react-redux之间的关系:
https://www.jianshu.com/p/728a1afce96d
React-redux的原理以及使用:
https://www.jianshu.com/p/1519690fce26
我看过的简书,可参考:https://www.jianshu.com/p/fc7470992482
下面这篇会用到redux-thunk ,redux-logger
https://www.jianshu.com/p/06f5285e2620
......后续再补上更深一点的。
网友评论