Pri*_*ens 34 javascript reactjs react-jsx
在React JSX中,我如何才能将以下文本包含在单引号中?还是其他可能需要转义的标点符号?
return (
<div>
<p>I've seen the movie.</p>
</div>
)
Run Code Online (Sandbox Code Playgroud)
小智 51
return (
<div>
<p>{"I've seen the movie."}</p>
</div>
)
Run Code Online (Sandbox Code Playgroud)
您可以使用“ html实体”在文本中加引号。
<Text>I"ve seen the movie.</Text>
Run Code Online (Sandbox Code Playgroud)
输出:我看过电影。
或者如果要单引号,请使用以下选项:
Run Code Online (Sandbox Code Playgroud)<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>
输出:我看过电影。
| 归档时间: |
|
| 查看次数: |
22886 次 |
| 最近记录: |