😍Nghiên cứu cách sử dụng Prop của FontAwesomeIcon

https://docs.fontawesome.com/v5/web/use-with/react#typescript

Cài đặt

yarn add -D @fortawesome/fontawesome-svg-core @fortawesome/free-brands-svg-icons @fortawesome/free-regular-svg-icons @fortawesome/free-solid-svg-icons @fortawesome/react-fontawesome

Cách 1

import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faPenNib } from '@fortawesome/free-solid-svg-icons'
import { faEnvelope } from '@fortawesome/free-solid-svg-icons'
function App() {
  return (
    <div className="App">
      <h3>How to use font-awesome in react</h3>
      <FontAwesomeIcon icon={faPenNib} />
      <FontAwesomeIcon icon={faEnvelope} />
    </div>
  );
}
export default App;

Cách 2

import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
function App() {
  return (
    <div className="App">
      <h3>How to use font-awesome in react</h3>
      <FontAwesomeIcon icon={["fas", "coffee"]} />
    </div>
  );
}
export default App;

Last updated

Was this helpful?