Skip to content

Commit

Permalink
Update StaticQuery article to link to open issue
Browse files Browse the repository at this point in the history
As seen in  gatsbyjs#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)
  • Loading branch information
tayiorbeii committed Jul 18, 2018
1 parent f26f438 commit 6514d73
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docs/docs/static-query.md
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 6514d73

Please sign in to comment.