logo
  • 教程列表
  • SO官方文档
  • 异步数据流
    • Redux-thunk 基础知识
    • 使用带有 jQuery.ajax 的 redux-thunk
    • 中间件
    • 动作创作者
    • 使用自定义中间件 Superagent
    • 使用带有 Promises 的 redux-thunk
  1. StackOverflow 文档
  2. redux 教程
  3. 异步数据流
  4. 动作创作者

动作创作者

Created: November-22, 2018

在 Redux 中处理异步的另一种方法是使用动作创建器。在 Flux 中,动作创建者是构造动作对象并派遣它们的特殊函数。

myActionCreator(dispatch) {
  dispatch({ type: "ASYNC_ACTION_START" });
  setTimeout(() => {
    dispatch({ type: "ASYNC_ACTION_END" });
  }, 1000)
}
  • 使用自定义中间件 Superagent
  • 中间件

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 关于我们
  • 免责声明