svrcekmichal / redux-axios-middleware

Redux middleware for fetching data with axios HTTP client
MIT License
918 stars 96 forks source link

Working with react hooks (useDispatch()) #106

Closed roshangm1 closed 5 years ago

roshangm1 commented 5 years ago

How do you use this library to manage promises properly when using useDispatch() hook to call a action creator ?

I am trying like this:

const dispatch = useDispatch();
dispatch(login())

Promise is resolved even if it goes to LOGIN_FAIL section in reducer.