Answers for "passing variable in usestaticquery"

0

passing variable in usestaticquery

// Using StaticQuery instead of useStaticQuery

import React from "react"
import Img from "gatsby-image"
import { StaticQuery } from "gatsby"

export default ({ src }) => {
  <StaticQuery
    query={graphql`
      query HeadingQuery($src: String!) {
         File(relativePath: { eq: $src }) {
           childImageSharp { ...etc }
         }
    `}
    render={data => (
       <Img fixed={data.path.to.query} />
    )}
  />
}
Posted by: Guest on August-16-2020

Code answers related to "passing variable in usestaticquery"

Code answers related to "Javascript"

Browse Popular Code Answers by Language