GraphQL in GatsbyJS
In this section, we'll learn about how GraphQL is used in the context of Gatsby. We will learn what the major difference is between how GraphQL is used by Gatsby and how it is exposed by Sanity's GraphQL API.
Gatsby's use of GraphQL is different from Sanity's since it uses the concept of a graph to formulate its GraphQL queries. Let's learn what a graph is.
In the following diagram, the figure consists of nodes and edges:
In Gatsby's implementation of GraphQL, in reference to the graph, each Sanity document is represented as a node. Recalling the GraphQL query that was used in Chapter 6, Sanity's GraphQL Playground, to return all events, this query was quite simple, as highlighted in the following code snippet:
{   allEvent {     name   } }
In Gatsby, we find that the corresponding query to return all events has two main differences...