Author -  Sai gowtham

How to include a Font Awesome 5 icons in React

Font Awesome is a toolkit that provides us different types of icons and social logos.

In this tutorial, we are going to learn about how to include the font awesome icons as components in React.

Installing react-icons package

First, we need to install a package called react-icons. which helps us to use the font awesome icons as a React components.

Run the following command to install the package.

npm install react-icons

Using Font Awesome icons

In this example, we are using Airbnb icon in the App.js file.

App.js
import React from "react";
import { FaAirbnb } from "react-icons/fa";
export default function App() {
  return (
    <div className="App">
      <h1>Hello Airbnb</h1>
      <FaAirbnb size={44} color="green" />    </div>
  );
}

In the above code, we first imported the FaAirbnb component from the react-icons/fa package then included it inside the App component.

Now, we can see the Airbnb svg icon is rendered on the screen.

react airbnb font awesome icon

Have you seen our icon has a green color because we added color to the <FaAirbnb> component by using color prop.

Similarly, you can include all Font Awesome icons by importing as react components.

For more icon names, you can checkout react-icons website.

Css Tutorials & Demos

How rotate an image continuously in CSS

In this demo, we are going to learn about how to rotate an image continuously using the css animations.

How to create a Instagram login Page

In this demo, i will show you how to create a instagram login page using html and css.

How to create a pulse animation in CSS

In this demo, i will show you how to create a pulse animation using css.

Creating a snowfall animation using css and JavaScript

In this demo, i will show you how to create a snow fall animation using css and JavaScript.

Top Udemy Courses

JavaScript - The Complete Guide 2023 (Beginner + Advanced)
JavaScript - The Complete Guide 2023 (Beginner + Advanced)
116,648 students enrolled
52 hours of video content
$14.99 FROM UDEMY
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
631,582 students enrolled
49 hours of video content
$24.99 FROM UDEMY
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
203,937 students enrolled
31.5 hours of video content
$14.99 FROM UDEMY