Redux Thunk Extension
npm install --save redux-thunk-ext
Then, to enable redux-thunk-ext, use applyMiddleware()
:
// store.js;;; const middlewares = thunk const storeEnhancers = const store =
Example
for my poor English, I just give a code to compare the difference between redux-thunk
and redux-thunk-ext
.
use redux-thunk
{ return async dispatch: Dispatch<GetComments>: Promise<void> let action: GetComments = await async let url = `/comments` try let result = await axios let data = result let comments = datadata return catch error return }
use redux-thunk-ext
{ return async dispatch: Dispatch<GetComments>: Promise<GetComments> let url = `/comments` try let result = await axios let data = result let comments = datadata return catch error return }
License
MIT