React bootstrap not styling my react components

后端 未结 5 1018
无人共我
无人共我 2021-02-12 14:22

Just started out using React yesterday so setting up a demo app. Environment is:

  1. Typescript
  2. Webpack
  3. React & React DOM

I\'m try

5条回答
  •  面向向阳花
    2021-02-12 15:22

    I ran into the same issue and this worked for me -->

    I ended up installing bootstrap with npm:

    • 1) npm i --save bootstrap

    Then, in index.js (where I render App.js) I imported bootstrap's minified css file from nodes_modules like so:

    • 2) import '../node_modules/bootstrap/dist/css/bootstrap.min.css';

    Now the responsive positioning is working (where as before I saw react-bootstrap rendering the correct class names, but without styling).

    Note: https://react-bootstrap.github.io/getting-started/introduction says you should add the css to the head of index.html. I did not have success doing it this way.

提交回复
热议问题