Table of contents
1.
Introduction
2.
Adding Bootstrap to React
3.
Using the Bootstrap CDN
4.
Bootstrap as Dependency
5.
React Bootstrap Installation
5.1.
Open the command line.
5.2.
Importing Bootstrap
6.
React Bootstrap Package
6.1.
React Bootstrap Installation
6.2.
Importing Bootstrap
7.
Using React Bootstrap
7.1.
Using reactstrap
7.2.
Reactstrap Installation
7.3.
Importing Reactstrap
7.4.
Using Reactstrap
8.
Frequently Asked Questions
8.1.
Can I use Bootstrap with any React project?
8.2.
Do I need to be online to use Bootstrap from a CDN?
8.3.
What's the difference between React Bootstrap and reactstrap?
9.
Conclusion
Last Updated: Aug 13, 2025
Medium

React Bootstrap

Author Riya Singh
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

Building a website that looks great & works smoothly is key for anyone stepping into the web development world. React Bootstrap is a toolkit that blends the simplicity of React with the flexibility & design of Bootstrap, making it a favorite among developers. This article will walk you through how to integrate Bootstrap into your React projects, covering everything from adding Bootstrap to your React app, to using specific React Bootstrap components to enhance your web pages. 

React Bootstrap

We'll explore various methods, including using the Bootstrap CDN, installing Bootstrap as a dependency, & diving into the React Bootstrap package for more tailored components.

Adding Bootstrap to React

When you're making a website with React, you might want to make it look good without spending too much time on the design. That's where Bootstrap comes in. Bootstrap is like a set of building blocks for websites. It gives you ready-made pieces, like buttons & forms, that you can use to build your site quickly & make it look professional.

To use Bootstrap with React, you first need to add it to your project. There are a few ways to do this, but let's start with the simplest one.

Using the Bootstrap CDN

CDN stands for Content Delivery Network. It's a way to use Bootstrap without having to download & install it. You just need to add a line of code to your project, & it will let you use Bootstrap's designs.

Here's how you do it:

  • Open your React project.
     
  • Find the index.html file in the public folder.

Add this line in the <head> section:

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">


This line of code tells your project to use the Bootstrap styles from the internet. Now, you can start using Bootstrap classes in your React components to make them look nicer.

For example, if you want to add a blue button to your page, you can do this in your React component:

<button className="btn btn-primary">Click Me</button>


The btn & btn-primary classes are part of Bootstrap, & they make your button look like a nice, blue Bootstrap button.

Bootstrap as Dependency

Another way to add Bootstrap to your React project is by including it directly in your project files. This method is like adding a new tool to your toolbox that you can use anytime, without needing the internet. It's handy because it makes your project more self-contained.

React Bootstrap Installation

To do this, you need to use your computer's command line, a place where you type commands to tell your computer what to do. Here are the steps:

Open the command line.

Go to your project's folder using the cd command. For example, if your project is in a folder called my-react-app on your desktop, you would type cd Desktop/my-react-app.

Type this command and press Enter:

npm install bootstrap


This command tells your computer to download Bootstrap and add it to your project. npm stands for Node Package Manager, which is a tool that helps you manage different parts of your project, like Bootstrap.

After running this command, Bootstrap is added to your project, and you can start using it just like when you used the CDN. But this time, you need to make sure Bootstrap is loaded into your React components.

Importing Bootstrap

To make Bootstrap available in your React project, you need to add one more line of code to your project. Open the index.js file in the src folder of your project, and at the top of the file, add this line:

import 'bootstrap/dist/css/bootstrap.min.css';


This line tells your React project to use the Bootstrap styles you just added. Now, you can use all the Bootstrap classes to make your components look nice, just like before.

React Bootstrap Package

If you want to make your React website look good with even less effort, there's something called React Bootstrap. It's like regular Bootstrap but made especially for React. This means it has components, or building blocks, that are ready to use in your React projects. These components are easy to use and can make your website look professional very quickly.

React Bootstrap Installation

To add React Bootstrap to your project, follow these steps:

Open your command line.

Make sure you are in your project's folder.

Type this command and hit Enter:

npm install react-bootstrap bootstrap


This command does two things. It adds the special React Bootstrap to your project and also includes the regular Bootstrap. This is because React Bootstrap needs the regular Bootstrap to work properly.

Importing Bootstrap

Just like with regular Bootstrap, you need to tell your React project to use React Bootstrap. You do this by adding a line of code to your files.

For example, if you want to use a React Bootstrap button, you first need to add this line at the top of your React component file:

import Button from 'react-bootstrap/Button';


This line means you're bringing the Button component from React Bootstrap into your file, so you can use it in your project.

Using React Bootstrap

Now that you have the Button component, you can use it in your component like this:

<Button variant="primary">Click Me</Button>

This will create a button that looks like a Bootstrap button but is made to work well with React. React Bootstrap has many components like this, such as forms, navigation bars, and more. You can look at the React Bootstrap documentation to find more components and learn how to use them.

Using reactstrap

reactstrap is another toolkit that combines Bootstrap with React. It's like React Bootstrap, offering ready-to-use components that fit well in React projects. reactstrap makes it easy to add Bootstrap-styled components to your website.

Reactstrap Installation

To use reactstrap in your project, you need to add it just like you did with React Bootstrap. Here's how:

  • Open your command line.
     
  • Go to your project's folder.
     
  • Type this command and press Enter:
npm install reactstrap bootstrap


This command downloads reactstrap and Bootstrap into your project. Remember, reactstrap needs Bootstrap to work, so we include both.

Importing Reactstrap

After installing, you need to let your React project know that you want to use reactstrap. For example, if you want to use a reactstrap button, you need to add a line to your component file like this:

import { Button } from 'reactstrap';


This line says, "Hey, I want to use the Button from reactstrap in this file."

Using Reactstrap

Now that you've imported the Button, you can use it in your component:

<Button color="primary">Click Me</Button>


This button will look like a Bootstrap button but is designed to work seamlessly in React, thanks to reactstrap. You can find many other components in reactstrap, such as Cards, Dropdowns, and Modals. Each one can be easily added to your project and customized to fit your design.

Frequently Asked Questions

Can I use Bootstrap with any React project?

Yes, you can add Bootstrap to any React project to make it look better easily.

Do I need to be online to use Bootstrap from a CDN?

Yes, using Bootstrap from a CDN requires an internet connection because your project loads Bootstrap from the web.

What's the difference between React Bootstrap and reactstrap?

Both are tools to use Bootstrap with React, but they're made by different people. They offer similar components, so you can choose the one you like more.

Conclusion

Combining React with Bootstrap offers a straightforward path to crafting visually appealing and responsive web projects. Whether you choose to incorporate Bootstrap via a CDN for speed, install it as a dependency for more control, or utilize React-specific libraries like React Bootstrap or reactstrap for seamless component integration, each method enriches your development toolkit. This guide aims to empower you with the knowledge to enhance your React applications with Bootstrap's styling capabilities, ensuring your projects not only function well but also stand out in terms of design and user experience.

You can refer to our guided paths on the Coding Ninjas. You can check our course to learn more about DSADBMSCompetitive ProgrammingPythonJavaJavaScript, etc. 

Also, check out some of the Guided Paths on topics such as Data Structure and AlgorithmsCompetitive ProgrammingOperating SystemsComputer Networks, DBMSSystem Design, etc., as well as some Contests, Test Series, and Interview Experiences curated by top Industry Experts.

Live masterclass