React JSX, how to render text with a single quote? Example <p>I've</p>
Render as a JS string literal (with double-quotes):
return (<p>{"I've seen the movie."}</p>)
... or use the HTML entity for an apostrophe, '
:
return (<p>I've seen the movie.</p>)
Nevermind, it works as is.
It was the IDE that was highlighting it as a mistake
You can use " html entity to have quote in your text.
<Text>I"ve seen the movie.</Text>
output: I"ve seen the movie.
or if want single quot use the below option:
<Text> I've seen the movie.</Text> <Text>{'I\'ve seen the movie.'}</Text> {/* you can use both ticks and single quotes depending on your use. */} <Text>{`I've seen the movie.`}</Text>
output: I've seen the movie.