Bootstrap 突然不适用于我的 React JS 项目 [英] Bootstrap suddenly not working for my React JS project
问题描述
突然,引导程序停止了我的项目.我不知道为什么.
Out of the blue bootstrap has stopped working on my project. I have no idea why.
这是我们的 package.json:
Here is our package.json:
{
"name": "blankets",
"version": "0.1.0",
"private": true,
"dependencies": {
"amazon-cognito-identity-js": "^1.26.0",
"aws-sdk": "^2.151.0",
"bootstrap": "^4.0.0",
"jwt-decode": "^2.2.0",
"prop-types": "^15.6.0",
"react": "^16.1.1",
"react-bootstrap": "^0.31.5",
"react-dom": "^16.1.1",
"react-router-dom": "^4.2.2",
"react-scripts": "1.0.17",
"react-select": "^1.0.0-rc.10"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
这是我们在 index.html 中的导入
Here is our import in index.html
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css">
任何帮助/建议/建议将不胜感激!谢谢!
Any help/advice/suggestions would be much appreciated! Thanks!
推荐答案
这个:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css">
正在加载最新版本的 Bootstrap,即 4.0.0.
is loading the latest version of Bootstrap which is 4.0.0.
而且因为 Bootstrap 4 与 Bootstrap 3 完全不兼容,这会破坏您的布局.
And because Bootstrap 4 is totally incompatible with Bootstrap 3 that breaks your layout.
解决方案:
要么为 Bootstrap 3 加载 css(以及相应的 js)文件,要么迁移到 Bootstrap 4.
Either load the css (as well as the corresponding js) files for Bootstrap 3 OR migrate to Bootstrap 4.
引导程序 3 链接:
https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css
https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js
这篇关于Bootstrap 突然不适用于我的 React JS 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!