From d8aaa2f346ea30fac760b0fb4359bb251779525a Mon Sep 17 00:00:00 2001 From: Taylor Bell Date: Wed, 18 Jul 2018 11:43:23 -0600 Subject: [PATCH] Update StaticQuery article to link to open issue As seen in https://github.com/gatsbyjs/gatsby/issues/6350 there is a bug that is preventing `StaticQuery` from working for page components. This PR alerts the reader to this issue, and provides a link to a (not-there-yet-but-soon) article for performing queries at the page level. ![](https://media.giphy.com/media/Ph0oIVQeuvh0k/giphy.gif) --- docs/docs/static-query.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/docs/static-query.md b/docs/docs/static-query.md index ac26645ccf921..56b756b7daf56 100644 --- a/docs/docs/static-query.md +++ b/docs/docs/static-query.md @@ -1,11 +1,14 @@ --- -title: "Querying data in non-page components using StaticQuery" +title: "Querying data in components using StaticQuery" --- -Gatsby v2 introduces `StaticQuery`, a new API that allows non-page components to retrieve data via GraphQL query. +Gatsby v2 introduces `StaticQuery`, a new API that allows components to retrieve data via GraphQL query. + +_Note: There is [a known issue with `StaticQuery`](https://github.com/gatsbyjs/gatsby/issues/6350) that only allows it to work with non-page components as seen in the example below. Until [#6350](https://github.com/gatsbyjs/gatsby/issues/6350) is resolved, page queries should be performed [as seen in this article](https://next.gatsbyjs.org/docs/build-a-page-with-graphql-query/)._ ## Basic example +We'll create a new `Header` component located at `src/components/header.js`: ```jsx import React from "react" import { StaticQuery, graphql } from "gatsby"