Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

104
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!