我有我的路由difined,当我导航到products/new
,工作正常,但如果刷新页面,他products/new
不进入,他返回意外的令牌。在react-router路由嵌套url
Route Config。
<Router history={createBrowserHistory()}>
<Route path="/" component={Layout}>
<IndexRoute component={Home} />
<Route path="produtos/novo" component={ProductsNew}/>
<Route path="produtos" component={Products} />
</Route>
您需要设置.htaccess或虚拟主机(如果您使用的是Apache)才能将所有请求指向您的应用所在的索引页面。 – Enijar
这个错误只发生在'''products/new''',刷新时其他页面时,这个工作正常。我的服务器是node + express。 –
您没有为您提供的代码中的'products/new'设置路线。这可能是原因,虽然我需要更多的信息来帮助你... – Enijar