3

How to enable template string in React Native? My code doesn't work:

<Text>{`My name is ${name}`}</Text>
1
  • I found the cause of a bug was coming from another part, not in Text. Commented Apr 21, 2020 at 7:09

1 Answer 1

10

There is no need of adding template strings inside a <Text> component for adding strings in react-native. You can just use simple text and for variables, you can wrap it with curly braces.

<Text>My name is {name}</Text>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.