简体   繁体   English

如何在 React JSX 中使用“< >”

[英]How to use the "< >" in React JSX

How can I use the < and > as text in React?如何在 React 中使用 < 和 > 作为文本? I am trying to use it for my portfolio?我想将它用于我的投资组合?

在此处输入图像描述

You would need to use HTML entities您需要使用HTML 实体

Reserved characters in HTML must be replaced with character entities. HTML 中的保留字符必须替换为字符实体。

Result结果 Description描述 Entity Name实体名称 Entity Number实体编号
< < less than少于 &lt; &#60;
> > greater than比...更棒 &gt; &#62;

HTML HTML

<div className="left-column">&lt;Lorenzo Codes

You could do something like:您可以执行以下操作:

<div className="left-column">{'<Lorenzo Codes'}

<div>{"<"} {">"} </div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM