在我的阵营路由器 - 终极版重拨应用程序,我们可以用两种URL特定网址:盼着来与路由器
- /帐户ID
- /帐户ID /语言
该语言是可选的。
当语言参数未设置时,我们必须强制使用“fr”语言。
react-router有没有可能自动将“/ accountId”改为“/ accountId/fr”?
IndexRoute没有任何路径属性来强制url并且重定向功能不符合我们的需要,我们希望在url中看到“/ accountId/fr”,这是因为一些SEO原因。
我试图在我的LandingCmp的渲染函数中进行调度(push(“/ accountId/fr”)),但它不起作用。
我们使用重拨(@provideHooks)来确保服务器端的一个干净的预渲染。
这里是我当前的路由表:
<Route path='/'>
<Route path="error" component={ErrorsCmp} />
<Route path=":accountId">
<Route path=":langue">
<IndexRoute component={LandingCmp} />
</Route>
<IndexRoute component={LandingCmp} />
</Route>
</Route>
我们用下面的依赖关系: - “反应路由器 - 终极版”: “4.0.5” - “反应路由器”:“2.7。 0“