DEV Community

Discussion on: Async Await usage and pitfalls in and chaining

stexx profile image
Stefan Breitenstein

Sure but I talk about the explicit the await, not the async part.

And here is a nice part of async functions:
They results always in a Promise, so you don't have to care about the return statement.
At least with the Promise/await part.

So what i mean

const usersData = await Promise.all( (id) => getUserData(id)) // returns always a promise, no gain to write also await.

There is even a eslint rule for that:

I think they explain the benefits and tradeoffs better than me :)