Chapter 8
- A promise is an object that represents the result of an asynchronous operation. The use of promises simplifies the code when performing asynchronous calls.
- The fetch API provides the
fetch()
method that you can use to make asynchronous network calls using JavaScript. - When using the REST API, it is recommended that you use the
useEffect
hook function if the request is sent after the first render. - You can access the response data using the promises with the
fetch()
method. The data from the response is saved to the state and the component is re-rendered when the state changes.