Reputation: 11
I downloaded fontawesome icons on vs code terminal with "npm i @fortawesome/react-fontawesome" and then other free solid and brands svg icons like this "npm i @fortawesome/free-brands-svg-icons"; "npm i @fortawesome/free-solid-svg-icons". Then when I wrote code with this icon, it shows me an error((.
`import './index.scss' import { Link, NavLink } from 'react-router-dom' import FontAwesomeIcon from '@fortawesome/react-fontawesome' import { faHome } from '@fortawesome/free-solid-svg-icons'
const SideBar = () => {
<nav>
<NavLink exact="true" activeclassname="active" to="/">
<FontAwesomeIcon icon={faHome} color="#4d4" />
</NavLink>
</nav>
</div>
}
export default SideBar `
Upvotes: 1
Views: 3689
Reputation: 200
The FontAwesomeIcon is not exported as default. You can import it with brackets around it.
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
Upvotes: 2