The Apollo Client gives us everything that we need to send requests from our React components. We have already tested that the client works. Before moving on, we should clean up our file structure, in order to make it easier for us later in the development process. Our front end is, at the moment, still displaying posts that come from static demo data. The first step is to move over to the Apollo Client and fetch the data from our GraphQL API.
Follow the instructions below to connect your first React component with the Apollo Client:
- Clone the App.js file to another file, called Feed.js.
- Remove all parts where React Helmet is used, and rename the class Feed, instead of App.
- From the App.js file, remove all of the parts that we have left in the Feed class.
- Furthermore, we must render the Feed class inside of the App class. It should like the following...