DEV Community

Discussion on: About async functions

Collapse
 
thorstenhirsch profile image
Thorsten Hirsch

Actually in your first example I find the then() based approach much more readable than the async/await approach, because the data is being chained or piped through the lines. I also think about it as a more functional way, whilst async/await is the procedural way.

I wouldn't always prefer then() over async/await. The latter is especially more suitable when there's just a single promise.

Collapse
 
tkdodo profile image
Dominik D

Yep, it's definitely a stylistic thing from time to time. To be honest, if you use TypeScript, the types flow through .then chains very nicely as well, so I don't really have a problem with that. I just don't really like that people sometimes stick async on a function for no apparent reason, possibly without knowing what it does and what it's for, so that was my main motivation to write this blog post :)