How to Build a Responsive Web App with React and Bootstrap
How to Build a Responsive Web App with React and Bootstrap

Building a modern web application doesn't have to mean starting from scratch. React provides a powerful way to build interactive user interfaces, while Bootstrap gives you a comprehensive collection of responsive layout tools and ready-made components.
Together, they make a great combination for quickly creating web applications that look good and work across desktops, tablets and mobile devices.
In this tutorial, we'll build a simple responsive web app using React and Bootstrap, covering everything from setting up the project to creating a responsive navigation bar and layout.
What You'll Need
Before getting started, you'll need:
- Basic knowledge of HTML and CSS
- Basic JavaScript knowledge
- Node.js and npm installed
- A code editor such as Visual Studio Code
- A web browser
We'll use Vite to create our React application because it provides a fast and lightweight development environment.
1. Create a React Project
Open a terminal and create a new React application:
npm create vite@latest responsive-app
When prompted, select:
Framework: React
Variant: JavaScript
Then move into the project directory:
cd responsive-app
Install the project dependencies:
npm install
Finally, start the development server:
npm run dev
Vite will provide a local address, normally something similar to http://localhost:5173. Open this address in your browser and you should see your new React application.
2. Install Bootstrap
Next, we'll add Bootstrap to the project. Run:
npm install bootstrap
We also want Bootstrap's JavaScript functionality, which is used by components such as dropdowns and responsive navigation menus. Open src/main.jsx and import Bootstrap:
import 'bootstrap/dist/css/bootstrap.min.css';
import 'bootstrap/dist/js/bootstrap.bundle.min.js';
You can now use Bootstrap's classes throughout your React components.
3. Clean Up the Default React Application
Vite creates some example files for us. For this tutorial, we can simplify the application. Open src/App.jsx and replace its contents with:
function App()
export default App;
We now have a clean starting point.
4. Create a Responsive Navigation Bar
One of the advantages of Bootstrap is that it already includes responsive components. Let's create a navigation bar by updating App.jsx:
function App()
export default App;
The important Bootstrap classes here are:
navbar-expand-lg: expands the navigation on larger screensnavbar-toggler: creates the mobile menu buttoncollapse navbar-collapse: controls the responsive menucontainer: keeps content within a responsive maximum widthms-auto: pushes the navigation links to the right
Resize your browser window and you'll see the navigation automatically adapt.
5. Create a Responsive Hero Section
Next, let's add a hero section underneath the navigation. Place it inside the fragment, directly after the closing
tag:
Build faster with React
A simple, responsive starting point built with Vite and Bootstrap.
The classes used here are:
py-5: adds vertical padding to the sectionrowandcol-lg-8: use the grid, so the content takes up eight of twelve columns on large screens and the full width on smaller onesdisplay-4andlead: set the size of the heading and the introductory paragraphbtn btn-primary btn-lg: creates a large call-to-action button
Wrapping Up
You now have a React application with a responsive navigation bar and hero section, built on Bootstrap's grid and components. From here you can add more sections, split the layout into separate React components and connect your app to real data.