Ami*_*.io 11 javascript state redux redux-saga
我在用redux-saga.在代码中yield* ReduxSaga.takeEvery('MY_ACTION', updatePorts);如何访问action以获取其字段.
例如,我有一个动作创建者:
function status(){
type: 'MY_ACTION',
status: true
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能action.status从我的传奇中获取?或者我是否只能通过getState()并选择访问数据?
Kok*_*lav 28
const actionCreator=()=>({
type: 'MY_ACTION',
status:true
})
function* updatePorts(action) {
console.log(action.status)
}
function* watchUpdatePorts() {
yield* takeEvery('MY_ACTION', updatePorts)
}
Run Code Online (Sandbox Code Playgroud)
https://github.com/redux-saga/redux-saga/tree/master/docs/api#takeeverypattern-saga-args
| 归档时间: |
|
| 查看次数: |
7303 次 |
| 最近记录: |