[React] 搭配使用 Bootstrap
May 3, 2021
載入
- 單純載入 Bootstrap
npm install bootstrap
- 除了安裝 Boostrap,還可安裝 React Bootstrap
npm install bootstrap react-bootstrap
使用
兩種載入方法都需先 import 原始的 bootstrap:
單純載入 Bootstrap 的使用方法同一般做法,參考官網:https://getbootstrap.com/docs/4.0/getting-started/introduction/
多安裝的 React Bootstrap,能像使用 React component 的方法使用 Bootstrap 的元件,例如:
官網介紹:https://react-bootstrap.github.io/getting-started/introduction
更多可使用的 components:https://react-bootstrap.github.io/components/alerts/