In this section, we are going to learn how to request resources from a server, using Hooks. First, we are going to implement requests by only using the JavaScript fetch function, and the useEffect/useState Hooks. Then, we are going to learn how to request resources, using the axios library in combination with react-request-hook.
Requesting resources with Hooks
Setting up a dummy server
Before we can implement requests, we need to create a backend server. Since we are focusing on the user interface at the moment, we are going to set up a dummy server, which will allow us to test out requests. We are going to use the json-server tool to create a full Representational State Transfer (REST) API from a JSON file.
...