Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
63
rated 0 times [  69] [ 6]  / answers: 1 / hits: 77206  / 9 Years ago, tue, october 6, 2015, 12:00:00

In React JSX how can I have the following text include a single quote? Or other punctuation that might need escaping?


 return (<p>I've seen the movie.</p>)

More From » reactjs

 Answers
9

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, &apos;:


return (<p>I&apos;ve seen the movie.</p>)

[#64816] Monday, October 5, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
trinityr

Total Points: 49
Total Questions: 107
Total Answers: 96

Location: Mayotte
Member since Fri, Oct 1, 2021
3 Years ago
;