Answer the question
In order to leave comments, you need to log in
How to type action in Redux thunk?
I'm just getting started with TypeScript. I have an action that returns some data to a component that I don't need to store in the store.
type responseExample = {
a: number
}
export const createCatalog = (data: FormData) => {
return async (dispatch: Dispatch<CatalogDispatchTypes>) => {
return await $axios.post<responseExample >(`/Catalog/Create`, data)
.then(response => {
return response.data
})
.catch(e => {
throw e
})
}
}
const qeury = dispatch(createCatalog({a: 1, b: 2}))
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question