1. 程式人生 > >Implementing the async/await syntax for promise request JavaScript

Implementing the async/await syntax for promise request JavaScript

Utilize async/await syntax with axios library

When developing an application using React and Redux, usually people tend to use a library called Axios to make life easier while working with promises. In the following example, I will show you how to implement the ES2017 syntax as easy as the previous example.

Final shape after clean up would be:

The final form of the promise function

Conclusion

ES2017 is cool and makes things more clear and increases code readability. I am trying to dive deeper once I get the chance that’s why I wanted to document any tips and hints that can help a developer to digest any new material. I hope that I could describe the theory for you and make it clear to understand. If you liked my post, please follow me here on Medium or leave a comment. You can follow me on twitter

@salmaneg. Thanks for reading!!!