15. Promise API and async/await
Overview
This chapter takes a deep dive into the Promise API and the methods used in order to make a network request. You will be introduced to another method, async/await, and eventually you will be able to explain why async/await is better than the Promise API. By the end of this chapter, you will have a good understanding of essential techniques in React and the modern way to fetch data from the server.
Introduction
JavaScript is a synchronous language and React, being a JavaScript framework, is synchronous too. Being synchronous means only one line of code can be executed at a time and the next line of code cannot start until the current code has finished executing. This can cause an issue when we make ...
Get The React Workshop now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.