一、React中使用jquery
1,在package.json里添加依赖
2,安装jquery:
npm install jquery --save
或npm install
3,index.js中将jquery作为模块引入,就可以使用了
二、React中使用bootstrap
方法1:
1,执行npm install bootstrap --save
2,index.js中引用bootstrap,例如:
import 'bootstrap/dist/css/bootstrap.css';
即可使用bootstrap样式,如添加<button class="btn btn-default" type="submit">Button</button>
其他使用方式:
引用:import bootcss from 'bootstrap/dist/css/bootstrap.css'
使用:<button className={bootcss.btn, bootcss['btn-primary']}>按钮</button>
参考https://blog.csdn.net/qq_29150765/article/details/81430072?utm_source=blogxgwz8
方法2:使用react-bootstrap
执行npm install react-bootstrap --save
引用:import { Navbar, Jumbotron, Button } from 'react-bootstrap';
import { Button } from 'react-bootstrap';