Co bills itself as a "stepping stone towards ES7 async/await", but I'm not really sure why I should use it over just writing async functions and using babel to compile. Are there any advantages and disadvantages to these approaches or is it just a question of preference?
Asked
Active
Viewed 159 times
0
-
async/await is not part of ES7. – Felix Kling Jun 22 '16 at 14:48
-
*"I'm not really sure why I should use it over just writing async functions"* you don't have to. As it says it's a stepping stone *towards* async/await. If you can use async functions with Babel, then do that. – Felix Kling Jun 22 '16 at 14:50
1 Answers
2
Async/Await is more like writing sync code and is where es is going. It's just syntax to make it simpler/more intuitive to write async code.
Evolution of Async Syntax:
callbacks --> promises --> async/await
This article shows how the syntax can make certain situations much more concise and arguably more intuitive.
-
-
Well, my answer as to why he might use it is because that's where ES is going, but your above point about async/await not being included in ES7 might make my point moot. – JohnnyFun Jun 22 '16 at 14:52
-
Yeah I much prefer writing async/await functions, I guess I'm just confused as to why co even exists/is so popular. Felt like there was something I was missing. – Joe Bushell Jun 22 '16 at 14:58
-
-
@FelixKling fair enough, I guess that's my question answered. Thanks for the help, I think I spend too much time worrying if I'm doing things 'right'. – Joe Bushell Jun 22 '16 at 15:04