1、Redux
是将react的state
进行全局管理,也就是管理整个项目的state
。
2、redux通过connect
高阶函数将state
与react
组件相连。也就是react要获取state
的值,必须通过connect
.
3、react通过dispatch
一个action
来set state
.
4、在redux中,当dispatch
一个actioner
(函数)时,会通过reducer
来更新state
。(dispatch时会自动触发reducer,而redux为只有唯一的一个状态树,多个reducer通combineReducers组成一个大的reducers。因此任何的状态改变操作共用一个订阅通知,会将改变的state与整个状态树进行比较然后修改)
redux 简单原理
猜你喜欢
转载自blog.csdn.net/zSY_snake/article/details/85329441
今日推荐
周排行