'Nextjs: multiple dispatch and Promise
This is my code:
Promise.all([
await dispatch(a()),
await dispatch(b()),
await dispatch(c()),
await dispatch(d())
]).then(console.log).catch(console.log);
And I get this log:
0: undefined
1: undefined
2: undefined
3: undefined
I want to get this data with Promise and I have to use await
Solution 1:[1]
the Promise.all will resolve after all async inside it are resolved so you dont need to await inside it as its an implicit await so remove the await fom inside the promis.all and check again.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ahmad Alsodani |
