【发布时间】:2020-12-31 15:43:42
【问题描述】:
我需要输入一些道具和参数这是代码的一部分。 createAction应该怎么写正确?
const onSubmitHandler = (userFormData: TuserDataFromForm) => {
console.log("this work");
// here is error - userFormData
dispatch(asyncAction(userFormData));
};
function* watchFunc() {
// here is error - asyncAction.type
yield takeEvery(asyncAction.type, workFunc);
}
// What should I write instead of any
// to not get error here - dispatch(asyncAction(userFormData)) - in Component
// and here - takeEvery(asyncAction.type, workFunc) - in sagas
const asyncAction: any = createAction("ASYNC_ACTION");
这里是完整的代码:
【问题讨论】:
标签: typescript saga redux-toolkit