Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Printing literal ' in React Native text object

I want to print:

Hi, let's do this:

the issue is, it won't work with the "let's" due to the apostrophe. If I use quotes around this (""), it prints the quotes as well in the view, which I don't want.

How do I do this in React Native?

like image 981
user1072337 Avatar asked Dec 19 '22 10:12

user1072337


2 Answers

Try this

<Text>{"Let's"}</Text>
like image 84
Andreyco Avatar answered Mar 11 '23 14:03

Andreyco


Try <Text>{"Hi, let's do this"}</Text>.

Any time you encounter any difficulty using a Text label, just remember that inside the brackets the rules of JavaScript apply, and so you can do anything in the same way that you would for a JS string.

like image 22
martinarroyo Avatar answered Mar 11 '23 14:03

martinarroyo