Graphql query to filter posts against dynamic category slug

I have below graphql query to extract blogs of a specific category. I want to pass dynamic value for slug field which I have stored in below variable. How can I do this?

const currCat = relatedPosts[0].node.categories[0].slug

const data = useStaticQuery(graphql`
 query  {
     allWordpressPost(filter: {categories: {elemMatch: {slug: {eq: "francais"}}}}) {
       edges {
         node {
           title
           excerpt
           slug
           categories {
             id
             name
             slug
           }
         }
       }
     }
   }
 `);

any suggestions people