Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React is not loading bootstrap css file

Here my component

import React from 'react'; 
import 'bootstrap/dist/css/bootstrap.css';
class Test extends React.Component{
 render(){
    return(
        <div>
            <button className="btn btn-danger"> Button </button>
        </div>
    )
 }
}
export default Test;

the button still a normal html button! this confuse me even in cmd there's no errors. I'm using react inside an ElectronJs app.

like image 601
Ayech Hamza Avatar asked Oct 19 '25 04:10

Ayech Hamza


1 Answers

Put it in the index.js file where your ReactDOM.render() exists,

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

It will be globally available to all of its child components rendering it.

like image 148
Punith K Avatar answered Oct 21 '25 18:10

Punith K