Home > Back-end >  Why can't I use certain free FontAwesome icons?
Why can't I use certain free FontAwesome icons?

Time:10-08

I'm working on a React App that uses Font-awesome. I'm able to get icons like the comment bubble working fine with import { faComment } from '@fortawesome/free-regular-svg-icons'. But there are certain icons such as the search icon that don't seem to be importable, despite being free. Does anyone know why there is this discrepancy between icons? What should I do in order to import the search icon? We are already using the <FontAwesomeIcon /> component syntax across the app so I would prefer to avoid <i class="fas fa-search"></i> if possible.

CodePudding user response:

I think it would be under solid, so fas, i.e fasSearch. I don't have it in front of me though

CodePudding user response:

This is working for me:

import React from "react";
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faSearch } from '@fortawesome/free-solid-svg-icons'

export default function App() {
  return (
    <div className="App">
      <FontAwesomeIcon icon={faSearch} />
    </div>
  );
}
  • Related