Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/421.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用react路由器和react路由器redux。当我转到localhost:9000/时,它工作正常,但不是localhost:9000/登录_Javascript_Express_Reactjs_Redux_React Router - Fatal编程技术网

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');