Overview

Page queries are queries used to fetch data in Gatsby page components. As we already know, page components in Gatsby are components that define web pages for the site. These components are exported from the src/pages directory or defined in the createPage action.

Writing page queries

First of all, please note that we cannot define more than one page query for the same page component. Gatsby searches for an exported query string from the page component and uses this as the query. This looks like this:

Get hands-on with 1400+ tech skills courses.