Promise chaining is dead. Long live async/await
Blog post from LogRocket
Async/await, often misunderstood as separate from promises, simplifies asynchronous code in JavaScript by providing a more readable and maintainable alternative to promise chaining. While both async/await and promises are interconnected, async/await is based on promises but eliminates the complexities and messiness associated with promise chaining. It allows developers to write cleaner code, making it easier to implement changes and maintain over time. Additionally, async/await can improve performance by allowing code to run in parallel without the need for Promise.all(), and it avoids the memory overhead and stack trace pollution caused by the creation of new anonymous functions in promise chains. Visual Studio Code and other IDEs facilitate the transition from promise chaining to async/await, enhancing the development experience and encouraging the adoption of this more efficient approach.