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

145
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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