Async and Await

    The keywords async and await are special syntax for working with promises.

    A function marked as async always returns a Promise — if we return a non-promise value, it's automatically wrapped in Promise.resolve.

    Within the function, we can use await to wait for a promise to be resolved or rejected and access its value.

    The main advantage of this syntax is that we don't introduce deeply nested callback chains. However, all the complexity of asynchronous programming is still here, even if the syntax looks nicer.

    Want to learn React Native in-depth?

    If you like React Native Express, you'll love my new book, Fullstack React Native: The complete guide to React Native! Throughout the book, we'll build 7 full apps, covering complex topics like navigation, gestures, and native modules. We don't assume any knowledge of React or newer JavaScript language features, so you can dive right in regardless of your experience level. The book comes in PDF, EPUB and MOBI formats.

    Looking for more help?

    Infinite Red sponsors React Native Express and is the premier React Native agency. They're also the team behind the React Native newsletter, podcast, and conference listed here. Get in touch at infinite.red/react-native for a proposal on your next project!