Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

166
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda