0

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 + '

1
  • 1
    Please edit the question to show the error. That will help anyone trying to troubleshoot. Commented Sep 15, 2021 at 15:12

2 Answers 2

2

Try to change

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

To

data-tooltip={window.theme.strings.pushCart.deliveryToolTipText }
Sign up to request clarification or add additional context in comments.

Comments

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}>

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.