I'm using react native with TypeScript and redux-toolkit
in my following code this typescript error occured
Expected 0 arguments, but got 1
i'm not sure which code should fix. i think this error is TypeScript errorHow can i fix my code?
signup.ts
const SignUp = () => { const hi = useCallback(() => {dispatch(login({email:'test'})); }, [dispatch, email]);}
action.ts
export const login = createAsyncThunk('user/login', async (data, {rejectWithValue}) => { try { const response = await axios.post('/user/login', data); return response.data; } catch (error) { // return rejectWithValue(error.response.data); } }, );
slice.ts
export const initialState = { email: '', me: null, userInfo: null, loginLoading: false, // 로그인시도중 loginDone: false, loginError: null, }; const userSlice = createSlice({ name: 'user', initialState, reducers: {}, extraReducers: builder => builder .addCase(login.pending, state => { state.loginLoading = true; state.loginDone = false; state.loginError = null; }) .addCase(login.fulfilled, (state, action) => { state.loginLoading = false; state.me = action.payload; state.loginDone = true; }) .addCase(login.rejected, (state, action) => { state.loginLoading = false; // state.loginError = action.payload; }), });