Is store.dispatch in Redux synchronous or asynchronous

ps-aux picture ps-aux · Apr 7, 2017 · Viewed 42.9k times · Source

I realize this is a basic question but I had no luck finding the answer elsewhere.

Is store.dispatch synchronous or asynchronous in Redux ?

In case it is asynchronous is there a possibility to add a callback after the action has been propagated as it is possible with React ?

Answer

agpt picture agpt · Apr 7, 2017

AFAIK, dispatching action is synchronous. In case if you are willing to address the asynchronous call, you can use the thunk-middleware in redux, where dispatch is provided as a callback function which you can invoke as per your convenience. For more info, checkout this answer on SO by Author itself: How to dispatch a Redux action with a timeout?