2017-03-04 24 views
1

工作,我有以下途径定义阵营热重装Redux的路由,当用户点击他被定向到着陆页(从路线上loginContainer登录按钮不刷新

<Route path='/' component={App}> 
     <IndexRoute component={LoginContainer} /> 
     <Route path='landing' component={LandingComponent} /> 
     <Route path='login' component={LoginContainer} /> 
    </Route> 

现在/降落)。所以,现在的URL更改 http://server:port/landing

现在,如果我修改一个文件,并用热模块重装(网络包开发服务器),我得到一个错误,说不能让http://server:port/landing保存。这是真的,因为没有这样的页面,我该如何解决这个问题。

我正在使用react-router,react-router-redux和webpack dev服务器。

回答

0

您需要在您的webpack dev服务器配置中启用historyApiFallback

这将重定向到404上的索引页面,从而允许路由器启动以查找您的子路由。

欲了解更多信息,请参阅this answer为什么这是必需的或其他更深入的内容。

相关问题