Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
React: GraphQL String interpolation is not allowed in graphql tag

I'm currently working on a gatsby project and a little stuck with queries.

Situation: I have a query of 6 teams, I would like to have 6 different buttons and based on if one of the buttons is selected, my website will display only that team instead of all 6

Problem: I'm working with GraphQL query and I'm aware that the query changes only on build. So my method of using String interpolation doesn't work

Query:

query {
allFile(filter: childMarkdownRemark {frontmatter: {title: {eq: ${selectedTeam }}}}}) {
                      edges {
                        node {
                          relativePath
                          childMarkdownRemark {
                            frontmatter {
                              title
                              teamDesc
                              teamPara
                            }
                          }
                        }
                      }
                    }
                  }

In my case selectedTeam is just a react state that is being updated everytime one of the teams is being clicked. Example: const [ selectedTeam, setSelectedTeam ] = useState('Executives')

Is there no way I can work around this or do I need to manually create a conditional rendering?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!