I have an error Expected 0 arguments, but got 1. in simple Redux Slice file.
This error occurs when I try to dispatch.
App.tsx
useEffect(() => {
dispatch(getMovies({ query: "searchQuery", page: 1 }));
}, []);
Slice.tsx
const movieSlice = createSlice({
name: "movie",
initialState,
reducers: {
getMovies(name) {
return name;
},
setMovies: (state, action: PayloadAction<Movie[]>) => {
state.moviesList = action.payload;
},
},
});
export const {
getMovies,
setMovies,
} = movieSlice.actions;
Where is the problem? Where to state that getMovies can accept an object as an argument?
Thanks