react 使用fortawesome字体图标
fontawesome 官方使用教程=>点我
import { FaLanguage } from 'react-icons/fa'; //https://react-icons.netlify.com/
react-blog
npm i --save @fortawesome/fontawesome-svg-core@prerelease \
npm i --save @fortawesome/free-solid-svg-icons@prerelease \
npm i --save @fortawesome/react-fontawesome@prerelease
入口文件引入
import { library } from '@fortawesome/fontawesome-svg-core'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faStroopwafel(图标样式以fa为前缀) } from '@fortawesome/free-solid-svg-icons'
library.add(faStroopwafel)
组件中使用
import React from 'react'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
export const Food = () => (
<div>
Favorite Food: <FontAwesomeIcon icon="stroopwafel" /> 不需要前缀
</div>
)