如何在推理组件中添加版权符号? [英] How to add a copyright symbol in reason-react component?

查看:123
本文介绍了如何在推理组件中添加版权符号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的理性人。我正在尝试在反应原因组件中添加版权符号。我已经尝试过

I’m new to reason-react. I’m trying to put a copyright symbol in a react-reason component. I've tried

<span >(ReasonReact.stringToElement("&copy;"))</span>

但这不会给我©符号。

but this doesn’t give me the © symbol.

推荐答案

使用unicode字符也是可能的,而且通常更简单:

It's also possible, and usually simpler, to just use the unicode character:

let copy = ReasonReact.stringToElement({js|\u00a9|js});

// Since ReasonReact 0.7.0 you can use
let copy = React.string({js|\u00a9|js});

或更短:

let copy = [%raw {|'\u00a9'|}];

只要整个工具链正确支持unicode字符,也可以直接使用unicode字符:

It's also possible to use unicode characters directly, as long as the whole toolchain supports it properly:

let copy = React.string({js|©|js});

然后为这两个选项中的任何一个都可以:

Then for either of these you can now do:

<span> {copy} </span>

这篇关于如何在推理组件中添加版权符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆