1// Using StaticQuery instead of useStaticQuery
2
3import React from "react"
4import Img from "gatsby-image"
5import { StaticQuery } from "gatsby"
6
7export default ({ src }) => {
8 <StaticQuery
9 query={graphql`
10 query HeadingQuery($src: String!) {
11 File(relativePath: { eq: $src }) {
12 childImageSharp { ...etc }
13 }
14 `}
15 render={data => (
16 <Img fixed={data.path.to.query} />
17 )}
18 />
19}