reactjs - 如何在 React 中包含 ASCII 码符号
问题描述
有什么方法可以在 React 中包含使用 ASCII 代码的图标。我已经在 HTML 中完成了这个,它工作得很好,但是当涉及到 React 时,它只会呈现整个字符串代码
<div class="page-btn">
<span>1</span>
<span>2</span>
<span>3</span>
<span>4</span>
<span>→</span> //in html this is a right arrow, in React this is just a plain code
</div>
解决方案
使用 javascript unicode 转义内联字符串。 右箭头是 Unicode 十六进制的 2192。(0x2192 == 十进制 8594)
<span>{"\u2192"}</span>
推荐阅读
- mysql - 如何根据状态 id 过滤搜索结果(发布 db-fiddle)
- java - 在 portlet/webapp 中是否提供 aspose 单元?
- graphics - 检测矩形交叉圆
- arrays - PowerShell 中的变量数组具有空成员
- postgresql - 如何在 Docker 上部署 postgres_exporter 并连接到 prometheus
- java - 是否有与 jdbc 或其他数据库交互的类(类似于 contentProvider)?
- regex - python 正则表达式从论文的doi中删除多余的字符
- angular - 使用“forRoot”将配置数据传递给角度库的依赖项
- php - 如何在 Laravel 中将带有访问器的属性正确设置到模型中?
- javascript - material-ui输入选择属性隐藏body溢出-y滚动-react js