How to install Bootstrap in React.js?

Member

by darion , in category: Javascript , 8 months ago

How to install Bootstrap in React.js?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by aniya.jaskolski , 8 months ago

@darion 

To install Bootstrap in React.js, you can follow these steps:

  1. Initialize a new React.js project by running the following command in your command line:
1
npx create-react-app your-app-name


  1. Change to the project directory:
1
cd your-app-name


  1. Install Bootstrap as a dependency by running the following command:
1
npm install bootstrap


  1. Open the src/index.js file and import the Bootstrap CSS by adding the following line at the top:
1
import 'bootstrap/dist/css/bootstrap.css';


  1. Save the changes and start the React development server by running the following command:
1
npm start


Now, Bootstrap is installed and ready to use in your React.js project. You can use Bootstrap classes and components in your JSX files by referring to the Bootstrap documentation.