DEV Community

Ali Hussain Dhuniya
Ali Hussain Dhuniya

Posted on

How to use FontAwesome Icons in React App without using npm/yarn package?

In case you are looking to include the font awesome library without having to do module imports and npm installs then put the SDK in public html head section like this :

<!DOCTYPE html>
<html lang="en">
    <meta charset="utf-8" />
    <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="theme-color" content="#000000" />
      content="Web site created using create-react-app"
    <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />

And use fontawesome class as you do without react but instead of class = "fa fa-home", write className = "fa fa-home"

<div className = "sidebar__menus">
<a className = " fa fa-home"  href = "#">
{view && view.menuheadings.fields.home}</a>
For more clarity watch the video

Stack overflow link:

Discussion (0)