async/await syntax encourages frontend developers to develop incorrect code
await operator is an incredible new feature in ECMAScript 2017. There are many articles demonstrating how much you can benefit from it. I agree: asynchronous code was never so brief and clear as when it is written via async/await syntax.
Nevertheless, there is a significant pitfall you should be aware of while developing asynchronous front end code. Backend developers are safe: they can easily copy code from any of the articles above to their NodeJS application, and it will work just fine. Really! However, if you are going to run this code in a browser environment as is, it would be a serious mistake! None of the examples is correctly adjusted for the front end. This is a disaster: in the top 10 Google references on “async await”, I failed to find any examples correctly adjusted for the front end. Junior/middle JS developers and newcomers use these examples as the basis for their work and develop incorrect code that results in unexpected bugs and performance loss all over the place.
No comments yet.
Add your comment