Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

164
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda