0

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());
Pero
  • 9
  • 2

1 Answers1

0

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.

phry
  • 4,685
  • 1
  • 10
  • 21