Create Blazing Fast Websites with Gatsby and Drupal
    • Training Introduction
    • Gatsby Overview
      • Gatsby Intro
      • What is React?
      • What is GraphQL
      • Babel & Webpack
    • Modern JS Overview
      • JS Map Function
      • Let and Const
      • Template Strings (Interpolated Literals)
      • Arrow Functions
      • Destructuring
      • Async... Await
    • Installing Gatsby
    • Gatsby Building Blocks
      • Gatsby Starters
      • Plugins & Themes
      • Gatsby Pages
      • About Page Solution
      • Building with Components
      • Gatsby Link Component
    • Styles in Gatsby
      • CSS and SASS
      • CSS Modules
      • CSS in JS
      • Emotion
    • Nested Layout Components
      • Layout Solution
    • Data in Gatsby
      • GraphQL in Gatsby
      • Query Types
      • Gatsby Source Drupal
      • Create Lists of Content
      • Gatsby Image Component
    • Portfolio Challenge
    • Deploying to Netlify
    • Bonus Lessons
      • Gatsby Contact Form
      • Pagination
      • Live Preview
      • Build Hooks
      • Dynamic Content
      • Algolia Search
    • Thank You

  • Gatsby Docs
  • Code Karate

  • Star
    • Training Introduction
    • Gatsby Overview
      • Gatsby Intro
      • What is React?
      • What is GraphQL
      • Babel & Webpack
    • Modern JS Overview
      • JS Map Function
      • Let and Const
      • Template Strings (Interpolated Literals)
      • Arrow Functions
      • Destructuring
      • Async... Await
    • Installing Gatsby
    • Gatsby Building Blocks
      • Gatsby Starters
      • Plugins & Themes
      • Gatsby Pages
      • About Page Solution
      • Building with Components
      • Gatsby Link Component
    • Styles in Gatsby
      • CSS and SASS
      • CSS Modules
      • CSS in JS
      • Emotion
    • Nested Layout Components
      • Layout Solution
    • Data in Gatsby
      • GraphQL in Gatsby
      • Query Types
      • Gatsby Source Drupal
      • Create Lists of Content
      • Gatsby Image Component
    • Portfolio Challenge
    • Deploying to Netlify
    • Bonus Lessons
      • Gatsby Contact Form
      • Pagination
      • Live Preview
      • Build Hooks
      • Dynamic Content
      • Algolia Search
    • Thank You

  • Gatsby Docs
  • Code Karate

Query Types

Github logo Edit on GitHub

Gatsby handles three varieties of GraphQL queries: Page queries (sometimes for simplicity referred to as “normal queries”), static queries using the <StaticQuery /> component, and static queries using the useStaticQuery hook.

Some things to consider:

  • Page queries can only be run on top level page components (in the src/pages folder)
  • Page queries can accept variables
  • Static queries (using the component or the hook) can't accept variables but can be called from any component

Read Gatsby Query Type Documentation

Previous
GraphQL in Gatsby
Next
Gatsby Source Drupal