title: How do I pass a value into an GraphQL query using gatsby and react?
body: <p>I am trying to grab something from my database using graphql by the items id, and I am not sure how to pass a value into graphql to grab it.</p>
  <pre class="lang-js prettyprint-override"><code>
  import React from &quot;react&quot;
  import { useStaticQuery, graphql } from &quot;gatsby&quot;
  
  const MyCustomComponent = (props) =&gt; {
    // How do I pass this value
    let theValueIWantToPass = 5
  
    // into this query
    const data = useStaticQuery(graphql`
      query MyQuery {
        mongodbItems(id: {eq: &quot;5&quot;}){
          id
        }
      }
    `)
  
  
    return (
      &lt;div&gt;
  
      &lt;/div&gt;
    )
  }
  
  
  export default MyCustomComponent
  </code></pre>