LANGUAGE/ReactJS

[REACTJS] fontawesome 적용

보겸삼촌 2020. 12. 7. 14:19

 

 

1. fontawesome npm install


  1.1. svg 기반 아이콘 활성화

npm install --save @fortawesome/fontawesome-svg-core


  1.2. 아이콘 패키지 설치

npm install --save @fortawesome/free-solid-svg-icons @fortawesome/free-regular-svg-icons @fortawesome/free-brands-svg-icons


  1.3. React 컴포넌트 형태로 사용

npm install --save @fortawesome/react-fontawesome



2. import icon

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

render(){
	return(
		<>
		<FontAwesomeIcon icon={faCamera} />
        </>
    )
}

 

 

[참고]

www.daleseo.com/react-font-awesome/

'LANGUAGE > ReactJS' 카테고리의 다른 글

[ReactJS] react html tag auto complete  (0) 2020.05.29
[ReactJS] git repository remote  (0) 2020.05.29