guys
Like in the subject is there a solution to wait until dispatch action is finished and then dispatch another?
Do I need thunk?
dispatch(someAction());
when someAction
is finished dispatch anotherAction()
dispatch(anotherAction());
guys
Like in the subject is there a solution to wait until dispatch action is finished and then dispatch another?
Do I need thunk?
dispatch(someAction());
when someAction
is finished dispatch anotherAction()
dispatch(anotherAction());
It really depends on the action. Normal non-thunk actions are synchronous, so in the next line after the dispatch
, the first action will already be 100% handled.
If you are dispatching thunk actions there, you can either await
or .then(..)
the value that is returned by dispatch
.