gpt4 book ai didi

react-native - 当我运行我的传奇时,出现此错误 "Error: call: argument [object Object] is not a function"

转载 作者:行者123 更新时间:2023-12-02 00:24:00 24 4
gpt4 key购买 nike

当 mi saga 被我的 action creator 触发时我有错误

"Error: call: argument [object Object] is not a function
at check (blob:file:///95bb5b45-c4c5-44db-9d56-d4dcee551ace:126468:13)
at getFnCallDesc (blob:file:///95bb5b45-c4c5-44db-9d56-d4dcee551ace:127645:22)
at call (blob:file:///95bb5b45-c4c5-44db-9d56-d4dcee551ace:127658:25)
at loginRequestSaga$ (blob:file:///95bb5b45-c4c5-44db-9d56-d4dcee551ace:128869:38)
at tryCatch (blob:file:///95bb5b45-c4c5-44db-9d56-d4dcee551ace:21519:19)
at Generator.invoke [as _invoke] (blob:file:///95bb5b45-c4c5-44db-9d56-d4dcee551ace:21694:24)
at Generator.prototype.(anonymous function) [as next] (blob:file:///95bb5b45-c4c5-44db-9d56-d4dcee551ace:21562:23)
at next (blob:file:///95bb5b45-c4c5-44db-9d56-d4dcee551ace:127025:29)
at proc (blob:file:///95bb5b45-c4c5-44db-9d56-d4dcee551ace:127000:5)
at runForkEffect (blob:file:///95bb5b45-c4c5-44db-9d56-d4dcee551ace:127241:21)"

我正在运行 react native 0.57 和最新版本的 redux saga

这是我的故事

import { put, call, select } from 'redux-saga/effects';
import { userServices } from '../../services';
import { userActions } from '../actions';
import { userConstants } from '../../constants/user.constants';

function* loginRequestSaga(action) {
try {
const data = yield call(userServices.fetchUser(action.credentials));
yield put(userActions.loginSucess(data));
} catch (e) {
console.log(e);
}
}

export const userSaga = {
loginRequestSaga,
};

预先感谢您的帮助

最佳答案

我已尝试回答您的确切问题,但如果不查看您的其余代码就很难知道,所以请原谅猜测。

call(fn, args) 需要一个函数,然后是一些参数,所以你可能想要:

function* loginRequestSaga(action) {
try {
//next line has changed
const data = yield call(userServices.fetchUser, action.credentials);
yield put(userActions.loginSucess(data));
} catch (e) {
console.log(e);
}
}

关于react-native - 当我运行我的传奇时,出现此错误 "Error: call: argument [object Object] is not a function",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54379624/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com