【发布时间】:2021-02-26 18:28:51
【问题描述】:
Accordingly to documentation 我可以将一些参数发送到 createAsyncThunk
export const someCustomAsyncThunk = createAsyncThunk(
'counter/customFetch',
async (someParam, thunkAPI) => { //<-- someParam ?
const response = await fetch('https://someapi');
return await response.json();
}
);
extraReducers: {
[someCustomAsyncThunk.fulfilled.type]: (state, action) => {
// state dispatching gonna be there
},
我在渲染中的某处有一个动作:
onClick={() => dispatch(someCustomAsyncThunk(38746))}
但我收到错误消息:Expected 0 arguments, but got 1.
我错过了什么?
【问题讨论】:
标签: reactjs redux react-redux redux-toolkit