[리액트] 아이콘 라이브러리

AI·2024년 8월 7일

리액트 아이콘에 대한 사이트
https://react-icons.github.io/react-icons/

아이콘을 사용하기 전에 라이브러리를 설치해야 합니다.

📌 설치 방법

// npm
npm install react-icons --save
// yarn
yarn add react-icons

📌 사용 방법
1. 필요한 아이콘을 좌측 검색창에 검색한다. (ex. trash)

  1. 마음에 드는 아이콘 선택
  1. import로 아이콘을 불러와서 사용
import { HiTrash } from "react-icons/hi2";

export default function TrashButton() {
  return (
   <button>
      <HiTrash />
    </button>
  );
}

0개의 댓글