put函数导致无限循环
来源:6-10 如何使用 React-redux(1)
DF11G
2020-09-30
import { takeEvery, put } from 'redux-saga/effects'
import { GET_INIT_LIST, GET_AJAX_VALUE } from './Actiontype'
import axios from 'axios'
import { getInitListAction } from './actionCreators'
function* getInitList() {
const res = yield axios.get('/todolist.json')
const action = getInitListAction(res.data)
yield put(action)
console.log(res.data)
}
function* mySaga() {
yield takeEvery(GET_INIT_LIST, getInitList);
}
export default mySaga;
put函数导致无限调用getInitList(),正如很多其他同学出现的问题一样,请问这是哪里的问题?
写回答
1回答
-
Dell
2020-10-06
加我微信dell-js,代码发我,我看下
00
相似问题