Introduction
Most modern apps receive data from servers and dynamically update the content. For example, a weather application will make requests to receive today's weather data from its servers. With React apps, it is also essential to communicate with servers in order to get the requested data to display content dynamically based on the user's interaction with the app.
In the previous chapters, we have seen how two components communicate with each other in React using render props and hooks. In this chapter, we will look at multiple ways to communicate with the outside world using APIs in React.
We will discuss the commonly used RESTful API, usually described as a web service that implements REST architecture (a convention for building HTTP
requests with HTTP
methods). After initiating a server request using the REST API
, we will test the server by making API requests with Postman, including GET
, POST
, PUT
, PATCH
and DELETE
requests. After you understand all the...