Javascript 使用react路由器和react路由器redux。当我转到localhost:9000/时,它工作正常,但不是localhost:9000/登录
我想知道我做错了什么 这是我的路由器的样子-Javascript 使用react路由器和react路由器redux。当我转到localhost:9000/时,它工作正常,但不是localhost:9000/登录,javascript,express,reactjs,redux,react-router,Javascript,Express,Reactjs,Redux,React Router,我想知道我做错了什么 这是我的路由器的样子- const router = ( <Provider store={store}> <Router history={history}> <Route path="/" component={App}> <IndexRoute component={Content} /> <Route path="/login" component={Log
const router = (
<Provider store={store}>
<Router history={history}>
<Route path="/" component={App}>
<IndexRoute component={Content} />
<Route path="/login" component={Login} />
</Route>
</Router>
</Provider>
);
const路由器=(
);
我按照Elod的建议进行了更新,但我仍然遇到同样的问题:(
const路由器=(
);
您已经定义了/
的父路由
无需在登录
组件级别添加/
。将其删除并保留
只有。应该帮你。谢谢Elod。我刚试过,重新启动了服务器,但还是一样的问题:(有错误,或者只是空白页。url更改了吗?它只是说,
无法获取/登录
你使用express吗?你如何导入历史记录,你使用的是hashHistory还是browserHistory我使用的是browserHistory
solution:
app.get('/*', function(req, res) {
res.sendFile(path.resolve(__dirname) + '/index.html');
solution:
app.get('/*', function(req, res) {
res.sendFile(path.resolve(__dirname) + '/index.html');