0

ERROR

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

I'm using font awesome icons in react js there are few icons is working like:- faPhoneAlt, faHeart, faBars, faChevronDown

but social media icons are not working.

Code

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>
Nisharg Shah
  • 16,638
  • 10
  • 62
  • 73
Rohit Verma
  • 3,657
  • 7
  • 37
  • 75

1 Answers1

1

For that, you need to install free-brands-svg-icons

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

In the doc it's clearly mentioned that for brands aka social media, you must to use another package.

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

Nisharg Shah
  • 16,638
  • 10
  • 62
  • 73
  • I found this may be it helps [github issue](https://github.com/FortAwesome/Font-Awesome/issues/14047) – antoineso Jan 04 '21 at 08:13
  • thanks for the suggestion but it's for `HTML` not for `react` because in `HTML` you need to use `fas` for solid and `fab` for solid brands – Nisharg Shah Jan 04 '21 at 08:15