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

110
Visualizações
Set data attribute using string in react

Just starting out in react and I've got a tooltip as part of a cart that I need to set the text for.

<a href="#" class="psh-Delivery_Link tip-Tooltip" data-tooltip={{ window.theme.strings.pushCart.deliveryToolTipText }}>test</a>

so I went to set the data-tooltip attribute, but this is giving me an error. Also tried data-tooltip="' + window.theme.strings.pushCart.deliveryToolTipText + '

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Try to change

data-tooltip={{ window.theme.strings.pushCart.deliveryToolTipText }}

To

data-tooltip={window.theme.strings.pushCart.deliveryToolTipText }
about 4 years ago · Juan Pablo Isaza Relatório

0

Take a look at the React tutorial on props. In summary, if you want to send a prop that is a string you can simple enclose it in quotes.

<a prop="value">

Otherwise use single curly braces (in which you can write any JavaScript statement)

<a prop={value.foo}>
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