How To Install/Add Bootstrap In React App

Today we are going to learn how to add bootstrap in react app.

  1. First of all, let’s create react using the below command.
    • npx create-react-app bootstrap-app
  2. After that using cd app-name select your react app in your terminal.
  3. After that let’s add bootstrap to react app, for that need to execute/fire below command in terminal.
    • npm install bootstrap@next –save (Note: this command will install the latest version of bootstrap if you want to install a specific version of bootstrap just specify the version after @)
  4. Now to use bootstrap in react app need to add it in index and app.js
    • Go to index.js and add the below lines to that js, this is for use of all bootstrap CSS and plusings in the app.
    • import 'bootstrap/dist/css/bootstrap.css';
      import bootstrap from 'bootstrap';

That’s it, Now you can add bootstrap class to your element to see bootstrap in action.
I have added Navbar to my app and it’s working fine.

Thanks

Let me know in the comment section if you’re facing any issues.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe

Select Categories