Is it possible to fire two types of actions in Redux at the same time?

0

I am using Redux and Redux-saga in an application with React and with doubt when displaying the load to the user when a saga is fired. I do not know if it is a good practice, but I was thinking about the possibility of firing 2 actions. 1 to display the load and another to trigger the saga. Is it possible to fire two types of action at a time?

    
asked by anonymous 14.06.2018 / 16:22

1 answer

0

Speaking of Redux , however hard you try, you'll only be able to fire one action at a time, this is because , the instructions are executed one at a time and even if you use href="https://github.com/redux-saga/redux-saga"> Redux-Saga , Redux- Thunk or whatever, to handle asynchronous actions, will remain one. But that does not mean that they will be resolved in the order they are executed.

In your case, this approach to an action before updating the loading state, a second action to do a fetch or another asynchronous operation, and a third action to change the loading status again is valid.

/ p>

When it comes to saga, I have no idea why I never used it. But the principle is the same.

    
17.06.2018 / 19:14