我正在使用React Router
这是我的App.js
import React, { Component } from 'react';
import {LandingPage} from "./landing.page";
import AppHome from "./app.home";
import { Route, Switch } from "react-router-dom";
class App extends Component {
render() {
console.log(localStorage.getItem('token'));
return (
<div className="App">
<Switch>
<Route exact path="/login" component={LandingPage} />
<Route
exact
path="*"
component={AppHome}
/>
</Switch>
</div>
);
}
}
export default App;
当我处于开发状态(npm启动)时,一切正常,我可以输入路径并重新加载,并且工作正常,但是当我进入服务器的生产环境(npm run build)并进入路径并重新加载时(示例/ login)我得到404 Not found nginx / 1.14.0(Ubuntu)
有人可以帮我吗
谢谢