redux中間件的pending success有意義嗎
1 回答

慕尼黑8549860
TA貢獻1818條經驗 獲得超11個贊
dispatch(action) 等于 composedABC(action) 等于執行 function A(action) {...}
在函數 A 中執行 next(action), 此時 A 中 next 為 composedBC,那么等于執行 composedBC(action) 等于執行function B(action){...}
在函數 B 中執行 next(action), 此時 B 中 next 為 composedC,那么等于執行 composedC(action) 等于執行function C(action){...}
在函數 C 中執行 next(action), 此時 C 中 next 為 store.dispatch 即 store 原生的 dispatch, 等于執行store.dispatch(action)
store.dispatch 會執行 reducer 生成最新的 store 數據
所有的 next 執行完過后開始回溯
執行函數 C 中 next 后的代碼
執行函數 B 中 next 后的代碼
執行函數 A 中 next 后的代碼
整個執行 action 的過程為 A -> B -> C -> dispatch -> C -> B -> A
- 1 回答
- 0 關注
- 775 瀏覽
添加回答
舉報
0/150
提交
取消