Re:Beware of Async/Await
by brundolf on Thursday July 30, 2020 @01:26PM
(#24000768)
But I maintain that in the illustrated case - where you want to get all the different independent values and then combine them at the end - it's actually less ergonomic to do it the wrong way with .then(...) than it is to do it the right way.
[ Parent
| on HN ]
Most ergonomic IMO is:
const getPeople = async () => (await Promise.all(...)).flat()
Without await this would be
const getPeople = () => Promise.all(...).then(arrs => arrs.flat())
The difference is slight to be sure, but I usually prefer the await approach.