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

147
Vistas
change className to using template literals

i'm trying to learn template literals, i have project of mine i need to use template literals there, i have a question which seems very simple, but dont know what i am doing wrong

this is working:

const classes = props.classes;

return (
<List
  component="div"
  data-testid="SelectionListt"

  className={classes.selectionList__sites}
>

</List>
);

my question is how should i turn that className using template literals.

This is what i have done:

 const classes = props.classes;

  return (
    <List
      component="div"
      data-testid="SelectionListt"
       className={` ${classes + ".selectionList__sites"} `}`
     
    >
    
    </List>
  );

this is my selectionList__sites:

 selectionList__sites: {
      backgroundColor: "white",
      "&:hover": {
        backgroundColor: " red",
        color: "black",
        border: "1px solid yellow",
      },
    },

English is not my mother language so there could be mistakes.

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

0

Template literals have no need for regular quotes inside them, basically the entire content between backticks is handled as a string, except for values inside ${}.

Assuming that props.classes is a string, I would write your className like this:

className={`${classes}.selectionList__sites`}
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