sajad torkamani

Install NPM package

npm install react-bootstrap

Include stylesheets

You can include the stylesheets in at least three different ways.

1. CDN

Include link to CDN. For create-react-app projects, this can go in <head> of public/index.html.

<link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
  integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"
  crossorigin="anonymous"
/>

2. CSS

You can include the following in a root file (e.g., src/index.tsx or App.tsx):

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

3. Sass

Configure Sass in your project if you haven’t already.

Install the bootstrap NPM package:

npm i bootstrap

Include the Bootstrap Sass entry file from the NPM package by including the following in a root Sass file (e.g., App.scss):

/* The following line can be included in a src/App.scss */

@import "~bootstrap/scss/bootstrap";

Make sure your root Sass file is imported in your app.

Sources