React: Building Modern Web Applications
by Jonathan Hayward, Artemij Fedosejev, Narayan Prusty, Adam Horton, Ryan Vice, Ethan Holmes, Tom Bray
Promises to the rescue
ES6 introduces a new native pattern for writing the asynchronous code called as Promise pattern.
This new pattern removes the common code issues that the event and callback pattern had. It also makes the code look more like a synchronous code.
A Promise (or a Promise object) represents an asynchronous operation. The existing asynchronous JavaScript APIs are usually wrapped with Promises, and the new JavaScript APIs are being purely implemented using the Promises.
Promises are new in JavaScript but are already present in many other programming languages. Programming Languages such as C# 5, C++ 11, Swift, Scala, and more are some examples that support Promises.
ES6 provides the Promise API using which we can create Promises and ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access