Skip to content

Commit

Permalink
chore(docs): Update useStaticQuery example code (#18681)
Browse files Browse the repository at this point in the history
* chore(docs): Update useStaticQuery example code

* Update testing-components-with-graphql.md
  • Loading branch information
HUFGhani authored and GatsbyJS Bot committed Oct 15, 2019
1 parent a5ec39f commit 6de032d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/docs/testing-components-with-graphql.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,15 @@ the Header component as:

```jsx:title=src/components/header.js
import React from "react"
import { StaticQuery, graphql } from "gatsby"
import { useStaticQuery, graphql } from "gatsby"

export const PureHeader = ({ data }) => (
<header>
<h1>{data.site.siteMetadata.title}</h1>
</header>
)

export const Header = props => (
export const Header = props => {
const data = useStaticQuery(graphql`
query {
site {
Expand All @@ -274,7 +274,7 @@ export const Header = props => (
`)

return <PureHeader {...props} data={data}></PureHeader>
)
}

export default Header
```
Expand Down

0 comments on commit 6de032d

Please sign in to comment.