Today we are going to learn how to add bootstrap in react app.
- First of all, let’s create react using the below command.
- npx create-react-app bootstrap-app
- After that using cd app-name select your react app in your terminal.
- 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 @)
- 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.