-1

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.

Dan Mandel
  • 637
  • 1
  • 8
  • 26
  • _"don't seem to be importable"_... what does this mean? What happens when you try? Do you get any errors? – Phil Oct 08 '21 at 03:28
  • No, there's no result for anything resembling a search icon. The project is already using 3 different font-awesome packages so I thought maybe there is a fourth that contains the other icons? I don't think so though. – Dan Mandel Oct 08 '21 at 03:30
  • 1
    [`faSearch`](https://github.com/FortAwesome/Font-Awesome/blob/master/js-packages/@fortawesome/free-solid-svg-icons/faSearch.js) is part of the `@fortawesome/free-solid-svg-icons` package – Phil Oct 08 '21 at 03:40

2 Answers2

1

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

AcidRaZor
  • 73
  • 1
  • 10
1

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>
  );
}
maxpsz
  • 431
  • 3
  • 9