Sending GraphQL Queries with Apollo Client

Now that we’ve covered the structure of our frontend application, it’s time to learn how to fetch and display data from the GraphQL API. We’ll start by using the allProducts query, which returns all the products in our application. Later on, we’ll cover advanced topics such as passing arguments, using fragments, and executing mutations.

We’ll also learn how to use regular and lazy queries with Apollo Client. We’ll also briefly go over React hooks, which are a feature that the Apollo library uses extensively.

Before we start

Before starting this section, we need to make a small change to the GraphQL schema on the server and add the id field to the Product type.

Get hands-on with 1200+ tech skills courses.