Consuming GraphQL APIs

Learn to use Apollo Client with React and Next.js and how to write GraphQL queries.

GraphQL has been a game changer in the API world, and it’s increasing its popularity thanks to its ease of use, modularity, and flexibility. For those who are not very familiar with GraphQL, it’s basically a query language for APIs first invented by Facebook back in 2012. It improves many key aspects of data fetching and manipulation compared to other web service architectures, such as REST or SOAP. In fact, it allows us to avoid data overfetching (we can simply query the data fields we need), get multiple resources within a single request, obtain a strongly and statically typed interface for our data, avoid API versioning, and so on.

Setting up Apollo Client with Next.js

In this lesson, we’ll be using Apollo Client, a very popular GraphQL client with built-in support for both React and Next.js for building a very simple online signbook.

Let’s start with a new project:

Get hands-on with 1400+ tech skills courses.