我有我的路由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