React 不呈现警报 (bootstrap)
React doesn't render Alert (bootstrap)
我向我的 React 添加了警报,但在浏览器中我只能看到纯文本。有什么问题?
我的组件:
import { Alert } from 'react-bootstrap';
class App extends Component {
render() {
return (
<div>
<Alert variant='warning'>
This is a warning alert—check it out!
</Alert>
</div>
);
}
}
export default App;
Bootstrap 已经安装
package.json:
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
...
"bootstrap": "^4.4.1",
"react": "^15.3.1",
"react-bootstrap": "^0.30.3"
}
...
}
我忘了导入样式表
import 'bootstrap/dist/css/bootstrap.min.css';
这是原因
我向我的 React 添加了警报,但在浏览器中我只能看到纯文本。有什么问题?
我的组件:
import { Alert } from 'react-bootstrap';
class App extends Component {
render() {
return (
<div>
<Alert variant='warning'>
This is a warning alert—check it out!
</Alert>
</div>
);
}
}
export default App;
Bootstrap 已经安装
package.json:
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
...
"bootstrap": "^4.4.1",
"react": "^15.3.1",
"react-bootstrap": "^0.30.3"
}
...
}
我忘了导入样式表
import 'bootstrap/dist/css/bootstrap.min.css';
这是原因