React 单向数据流
React 单向数据流

redux中目录结构:


Actions

  • 声明action

Components

  • 创建component
  • 组合子component与container
  • 接收container传过来的属性

Containers

  • 引用component、action
  • 将action与state dispatch到component的props上

Reducers

  • 引入action
  • 初始化state
  • 定义action需要完成的具体动作
  • 更新state

Sagas

  • 引入action
  • 监听特定action
  • 异步按指定顺序执行action或自定义方法

Store

  • 引入reducer与middleware
  • 导出配置

index.js

  • 引入component、configureStore、saga
  • 通过configureStore创建store,runSaga
  • Provider 中赋值store
  • 渲染组件

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-27
  • 2021-07-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-29
  • 2022-12-23
  • 2022-12-23
  • 2021-06-12
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案