react-bootstrap是一个非常受欢迎的针对react封装过的bootstrap,它本身不包含css,所以也是需要使用bootstrap原生库。

在create-react-app建的项目目录中安装react-bootstrap。

npm install react-bootstrap --save

安装bootstrap。

npm install bootstrap@3.3.7 --save

 

在index.js文件中增加css引用。

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

 

在需要用到bootstrap组件的代码中,引入所需组件。

import { Navbar, Jumbotron, Button } from 'react-bootstrap';

 

react-bootstrap参考:

https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#adding-bootstrap

https://react-bootstrap.github.io/getting-started.html

相关文章:

  • 2022-01-11
  • 2021-08-11
  • 2022-12-23
  • 2018-12-07
  • 2022-12-23
  • 2021-08-07
  • 2021-11-29
  • 2021-10-06
猜你喜欢
  • 2021-07-22
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2021-12-31
  • 2021-12-05
  • 2021-10-07
相关资源
相似解决方案