How to include bootstrap css and js in reactjs app?

后端 未结 19 1175
既然无缘
既然无缘 2020-12-04 05:07

I am newb to reactjs, I want to include bootstrap in my react app

I have installed bootstrap by npm install bootstrap --save

Now, want to load b

19条回答
  •  无人及你
    2020-12-04 05:35

    You can just import the css file wherever you want. Webpack will take care to bundle the css if you configured the loader as required.

    Something like,

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

    And the webpack config like,

    loaders: [{ test: /\.css$/, loader: 'style-loader!css-loader' }]
    

    Note: You have to add font loaders as well, else you would be getting error.

提交回复
热议问题