Ich habe gerade ein neues Projekt mit react cli erstellt und npm bootstrap installiert.npm Bootstrap arbeitet nicht an einem neuen Reaktionsprojekt
npm install bootstrap --save
Ich habe versucht, dann Bootstrap in App.js:
import React, { Component } from 'react';
import './App.css';
class App extends Component {
render() {
return (
<div>
<div className="container">
<h1>It Works!</h1>
</div>
</div>
);
}
}
export default App;
aber es funktioniert nicht.
Das ist mein package.json:
{
"name": "myapp",
"version": "0.1.0",
"private": true,
"dependencies": {
"bootstrap": "^3.3.7",
"react": "^15.5.4",
"react-dom": "^15.5.4"
},
"devDependencies": {
"react-scripts": "1.0.7"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
Hier ist meine index.html:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1>
<title>React App</title>
</head>
<body>
<div id="root"></div>
</body>
</html>
Gibt es noch etwas, das ich zu tun, um brauchen, damit es funktioniert?
Ich sehe nicht, dass Sie Skripte oder Bootstrap CSS innerhalb des Index HTML hinzugefügt haben. Hast du das probiert? – German
Es tut uns leid, Paket.json aktualisiert – dj2017