React-Bootstrap Badge Component
React-Bootstrap is a front-end framework that was designed keeping react in mind. Bootstrap was re-built and revamped for React, hence it is known as React-Bootstrap.
Badges are used for indication purposes like to show the notifications number, and we can also display messages using variants that come with this framework.
- pill: It is used to make the more rounded badges and adds some horizontal padding.
- variant: It is used to add different themes and visual styles for badges.
- variant: It is used for visual styling.
- bsPrefix: It is an escape hatch for working with strongly customized bootstrap css.
Creating React Application And Installing Module:
Step 1: Create a React application using the following command:
npx create-react-app foldername
Step 2: After creating your project folder i.e. foldername, move to it using the following command:
Step 3: After creating the ReactJS application, Install the required modules using the following command:
npm install react-bootstrap bootstrap
Step 4: Add the below line in index.js file:
Project Structure: It will look like the following.
Example: Now write down the following code in the App.js file. Here, App is our default component where we have written our code.
Step to Run Application: Run the application using the following command from the root directory of the project:
Output: Now open your browser and go to http://localhost:3000/, you will see the following output.