re: What was your win this week? VIEW POST

FULL DISCUSSION
 

This week, I replaced promise...then...catch with async/await in an app and took the time to throw relevant errors. It has made the code much easier to read. Next step is to add try/catch blocks to refine error handling.

I also ran 3 days this week (wish it would get warm! Hurry up Spring!)

 

What’s the main benefits of async/await over promise.then.catch? Is speed one of them?

 

I haven't seen any performance improvements in my code. It's just that the code is clearer and therefore more readable and maintainable. Without the then/catch blocks its much shorter as well. I haven't measured this, but in a large project there could even be measurable decrease in overall bundle size. However, at the end of the day async/await is still a promise under the covers.

code of conduct - report abuse