I'm trying to make my app with Redux Toolkit and Tsx.
Here you can see how i'm calling the API in my slice
export const getProducts = () => (dispatch: Dispatch) => {
try {
axios({
method: 'GET',
url: 'https://xxxx/products',
}).then((response) => {
setProductList(response.data.data)
dispatch(setProductList(response.data.data))
})
} catch (error) {
console.error(error)
}
}
And in my component this gives me a type error from Typescript
useEffect(() => {
dispatch(getProducts()) Argument of type 'dispatch:Dispatch) => void is not assignable of type 'AnyAction'.
}, [])
```
The code works but I'm getting this warning and I don't know how to dix it, I've tried changing dispatch for Type "Any" but I still get a warning