社交媒体字体很棒的图标在 React JS 中不起作用

Social Media font awesome icon is not working in react js

错误

Attempted import error: 'faTwitter' is not exported from '@fortawesome/free-solid-svg-icons'.

我在 React js 中使用字体很棒的图标,有几个图标的工作方式如下:- faPhoneAlt、faHeart、faBars、faChevronDown

但社交媒体图标不起作用。

代码

import React, {Component} from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import {faMapMarkerAlt, faPhoneAlt, faShoppingBag, faHeart, faBars, faChevronDown, faTwitter} from '@fortawesome/free-solid-svg-icons';


<FontAwesomeIcon icon={faTwitter} /></Link>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>

为此,您需要安装 free-brands-svg-icons

https://www.npmjs.com/package/@fortawesome/free-brands-svg-icons

在文档中明确提到,对于 brands 又名 social media,您必须使用另一个包。

https://fontawesome.com/how-to-use/on-the-web/using-with/react