如何在React的render()中包含一个Font Awesome图标 [英] How to include a Font Awesome icon in React's render()
本文介绍了如何在React的render()中包含一个Font Awesome图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
每当我尝试在React的render()
中使用Awesome字体图标时,尽管它可以在正常的HTML中运行,但它不会显示在结果网页上.
Whenever I try to use a Font Awesome icon in React's render()
, it isn't displayed on the resulting web page although it works in normal HTML.
render: function() {
return <div><i class="fa fa-spinner fa-spin">no spinner but why</i></div>;
}
这是一个实时示例: http://jsfiddle.net/pLWS3/
哪里出问题了?
推荐答案
React使用className
属性,例如DOM.
React uses the className
attribute, like the DOM.
如果您使用开发版本,并查看控制台,则会出现警告.您可以在jsfiddle上看到它.
If you use the development build, and look at the console, there's a warning. You can see this on the jsfiddle.
警告:未知DOM属性类.您是说className吗?
Warning: Unknown DOM property class. Did you mean className?
这篇关于如何在React的render()中包含一个Font Awesome图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文