Writing GraphQL Queries

Learn how to structure and build queries to fetch data in Gatsby.

Overview

We already know about the GraphiQL explorer and how to add data sources. Now, let’s look at how to write GraphQL queries when necessary to fetch data from these sources.

Building a GraphQL query

A typical GraphQL query in Gatsby consists of two major parts: the graphql API in line 1, and the query string in the highlighted section below:

Get hands-on with 1400+ tech skills courses.