如何与fontawesome一起做出反应?

时间:2018-02-03 07:26:49

标签: javascript reactjs npm font-awesome jsx

我在npm安装了react-create-app,并在npm安装了react-fontawesome。但是我如何在项目中包含fontawesome的CSS样式?

我的工作空间 my work space

1 个答案:

答案 0 :(得分:1)

Probably at the moment react-icons is the best way of including FA icons into your app, as it only brings in those icons, which are used in your project, not all the icon sheet

https://gorangajic.github.io/react-icons/

import FaBeer from 'react-icons/fa/beer';

class Question extends React.Component {
    render() {
        return <h3> Lets go for a <FaBeer />? </h3>
    }
}

P.S. to answer your question..

this is what the docs of your react-fontawesome say

The fastest way to get started is to import FontAwesome with a link tag in your page's :

 <link
 href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
 rel="stylesheet" />