This post will help your add bootstrap to Create React App locally using yarn and npm. But, this is how bootstrap is added to any nodejs project, so you can basically add bootstrap any nodejs project the same way. Let’s get started now.
I assume that you already have installed nodejs, npm, yarn and created your create-react-app.
Save Bootstrap to Create React App
To save bootstrap to your create react app or any nodejs app you can use yarn or npm commands. Copy one from below and run it from your app root directory.
yarn add bootstrap
npm install bootstrap
Once it completes fetching and saving bootstrap to your app. Run the create react app server and open src/index.js file and add the following code.
yarn start
npm start
src/index.js
import React, {useState} from 'react';
import ReactDOM from 'react-dom';
import 'bootstrap/dist/css/bootstrap.min.css' //added