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

160
Vistas
how to use template literal strings for modular css with JSX?

I want to be able to give a different className when mapping through an array of images like so:

{array.map((step, i) => {
        return (
          <>
            <img className={styles.img`${i}`} />
          </>
        )
      })}

However I keep getting an error on Gatsby: Error in function eval in ...file path and then filepath_module_scss__WEBPACK_IMPORTED_MODULE_1_.default.img is not a function

What syntax error am I doing here? How can I dynamically change classNames if not like this?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I am not sure how your styles look like but maybe that would work:

<img className={styles.img[i]} />

or

<img className={styles[`img${i}`]} />
about 4 years ago · Juan Pablo Isaza Denunciar
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