How to dispatch more actions in 1 yield via PUT
See original GitHub issueWhy is redux-saga
not dispatching action when used in this form:
function* updatePorts(action) {
const {response} = yield SagaEffects.call(apiUpdatePorts, action.ports);
if (response) {
yield (() => {
console.log("Dispatching - ", action.actionAfter);
SagaEffects.put(action.actionAfter);
})();
But it works in this manner:
function* updatePorts(action) {
const {response} = yield SagaEffects.call(apiUpdatePorts, action.ports);
if (response) {
yield SagaEffects.put(action.actionAfter);
I would like to dispatch 2 actions in 1 yield
thats why I am trying to use the arrow function (() => {})
.
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (2 by maintainers)
Top Results From Across the Web
Dispatching Actions | Redux-Saga
Dispatching actions to the store. Taking the previous example further, let's say that after each save, we want to dispatch some action to...
Read more >Javascript: Redux: Dispatching Multiple Actions - Medium
The answer of course is, yes, just either call dispatch multiple times or iterate dispatch over an array. Usually, though, if you're dispatching...
Read more >Can I dispatch multiple actions from Redux action creators?
Actually, this is a trick question; with the appropriate store middleware, it is possible to do both at once! How does this work?...
Read more >Different Ways to Dispatch Actions with Redux - Pluralsight
The dispatch method is available on the store object. An action gets dispatched to trigger an update to the Redux store. 1// App.js ......
Read more >Chaining Asynchronous Dispatches in Redux Toolkit - YouTube
In this video I cover how we can correctly dispatch one action after another, where the second dispatch is informed by the state...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This post ranks high in google for this question, so thought I’d mention the above is deprecated and that you now want to do:
⚠ see @kyle-ssg 's answer below. This one is depricated
@slorber It worked. I used it this way: