ATTzz
ATTzz

Reputation: 1

Quick Question about FontAwesome in Reactjs

So I'm learning Reactjs and i want to use FontAwesome in my project. But i have 1 problem. In their documentation, it said:

import { fab } from '@fortawesome/free-brands-svg-icons'
import { faCheckSquare, faCoffee } from '@fortawesome/free-solid-svg-icons'

fab : which represents all of the brand icons in @fortawesome/free-brands-svg-icons. So any of the brand icons in that package may be referenced by icon name as a string anywhere else in our app. For example: "apple", "microsoft", or "google".

faCheckSquare and faCoffee : Adding each of these icons individually allows us to refer to them throughout our app by their icon string names, "check-square" and "coffee", respectively.


So i want to know which will represent all solid-svg-icons?

If i need 20 icons in my component, then i will have to write all 20 faCheckQuare, faCoffe, ... right? Please tell me if there is any way better than this? Many thanks.

Upvotes: 0

Views: 36

Answers (1)

Hardik Satasiya
Hardik Satasiya

Reputation: 9693

You can import them all.

import * as SvgIcons from '@fortawesome/free-solid-svg-icons'

and then start using them.

SvgIcons.faCheckSquare
SvgIcons.faCoffee 
// etc ...

if anything else you need to know please comment.

Upvotes: 1

Related Questions