简体   繁体   中英

how to add bootsrap link in specified reactJS file?

i'm using react js for my project and i needed to use bootstrap in some pages of my application , so i put the <link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" /> in the Public folder in index.html but that apply the bootsrap in all pages ..fontFamily has been changed in pages ..

i want to apply it for a specific react js file

how can i import <link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" /> in a react js file please ?

thanks for your help .

You can install bootstrap npm package

npm install bootstrap

and then import it in JS files

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

The link below will help

How to use Bootstrap with React

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM