DEV Community

Discussion on: Gotchas about async/await and Promises

Collapse
 
kayis profile image
K

Or like this:

doSomething()
  .then(data => Promise.all([data, doStuff(data)]))
  .then(([data, result]) => Promise.all([data, result, doOtherStuff(data, result)]))
  .then(([data, result, outcome]) => showOutcome(data, result, outcome));

Clean and simple approach, but passing around of all the values is quite cumbersome.

Collapse
 
aghost7 profile image
Jonathan Boudreau

My main point was that you can still get a "flat" result when you have interdependent calls.

You can also pull this off with callbacks.