How to add instagram icon in react js?
July 12, 2024Hi Friends π,
Welcome To aHoisting!
To add instagram icon in react js, you can import { FaInstagram }
from react-icons/fa'
. It will add instagram icon in react js.
Today, I am going to show you, how to add instagram icon in react js.
Table of contents
- Install and create a new React app.
- Import react component.
- Create a Component.
Letβs start with the first step.
Step 1: Install and create a new React app.
First you have to install the React project. You should use create-react-app
command to create a new React project.
npx create-react-app my-app
cd my-app
npm start
Install React Icons:
Use npm or yarn to install the React Icons library.
npm install react-icons
Step 2: Import react component.
After installing, you have to import your React component. To do this, add the following line to the top of your component file.
import React from 'react';
import { FaInstagram } from 'react-icons/fa';
import './App.css';
Step 3: Create a Component.
You can use <FaInstagram />
to add instagram icon in react js.
<div className="icon-container">
<FaInstagram className="instagram-icon" />
</div>
Add instagram icon example.
The below code is an example of a React. You have to import react-icons/fa'
and set <FaInstagram />
to add instagram icon in react js.
App.js
import React from 'react';
import { FaInstagram } from 'react-icons/fa';
import './App.css';
const InstagramIcon = () => {
return (
<div className="icon-container">
<FaInstagram className="instagram-icon" />
</div>
);
};
export default InstagramIcon;
App.css
.icon-container {
display: inline-block;
margin: 10px;
}
.instagram-icon {
color: #E1306C;
font-size: 30px;
transition: transform 0.3s;
}
.instagram-icon:hover {
transform: scale(1.1);
}
In the above code example, I have used the 'react-icons/fa'
to add instagram icon in react js.
Check the output of the above code.
All the best π