redux 有点类似flux。但是我觉得远比flux要复杂。因为他非常的绕。一般搭配使用是redux 和react-redux 使用。

主要的思路就是:

写action:动作类型

写reducer:动作计算过程

写store:将action和reducer结合起来,创建store,一般结合reducer用combinereducer这个函数。

创建store之后,就可以用了,因为用的是react-reducer。所以得在provider里面用/

主要是两个函数

mapStateToProps    这个是拿到store
mapDispatchToProps  这个是更新store


好了,包子只写了一个小demo,还要继续研

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-20
  • 2021-11-07
猜你喜欢
  • 2021-06-27
  • 2022-12-23
  • 2022-12-23
  • 2022-01-18
  • 2021-09-05
  • 2021-04-11
  • 2022-12-23
相关资源
相似解决方案