bootstrap reactjs code example

Example 1: add bootstrap to react

1.run commnad in cmd
npm install bootstrap --save

2.after install add this to index.js
import 'bootstrap/dist/css/bootstrap.min.css';

Example 2: install react bootstrap

# with npm
npm install react-bootstrap bootstrap

#with yarn
yarn add react-bootstrap bootstrap

Example 3: react import bootstrap css

{/* The following line can be included in your src/index.js or App.js file*/}

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

Example 4: install boostrap react

npm install react-bootstrap bootstrap

Example 5: react bootstrap

// Install react-bootstrap and bootstrap module 
npm i react-bootstrap bootstrap

// Import bootstrap so that the styles work
import 'bootstrap/dist/css/bootstrap.min.css';

// Use react-bootstrap
import { Button } from 'react-bootstrap'

{ // Some Component
  <Button /> // Displays a nice blue button :)
}

Example 6: react bootstrap

npm install react-bootstrap bootstrap@4.6.0

Tags: