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

  • 關於本站
  • 免責聲明