Не работает Route. Пишет: "Cannot GET /login". использую react+webpack. Подскажите причину, пожалуйста. Вот часть кода(где, на мой взгляд, может быть причина ошибки):
import React, { Component } from 'react';
import { BrowserRouter as Router, Route } from "react-router-dom";
import Signup from "./Signup"
import Login from "./Login"
import SecretComponent from './SecretComponent';
class App extends Component {
render() {
return (
<Router>
<div>
<Route exact path="/" component={Signup} />
<Route path="/login" component={Login} />
<Route path="/secretpage" component={SecretComponent} />
</div>
</Router>
);
}
}
export default App;
{
"name": "react_webpack_starter",
"version": "1.0.0",
"description": "Boilerplate for React apps",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --mode development --open --hot",
"build": "webpack --mode production"
},
"author": "Brad Traversy",
"license": "MIT",
"dependencies": {
"axios": "^0.18.0",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-router-dom": "^4.3.1"
},
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.0.0-beta.56",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.4",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-preset-env": "^1.6.1",
"babel-preset-es2016": "^6.24.1",
"babel-preset-react": "^6.24.1",
"css-loader": "^0.28.11",
"html-webpack-plugin": "^3.1.0",
"style-loader": "^0.20.3",
"webpack": "^4.4.0",
"webpack-cli": "^2.0.13",
"webpack-dev-server": "^3.1.1"
}
}