0
我的路由配置是這樣的:陣營路由器V4嵌套
[
{
path: '/',
exact: true,
component: Dashboard
},
{
path: '/stories/:storyId',
component: Story,
},
{
component: Dashboard,
status: 404
}
]
現在故事構件的內部我想呈現一個畫廊,每一張照片都需要有自己的網址。有這樣的事情:
<Switch>
<Redirect from={match.url} to={`${match.url}/1`} />
<Route path={`${match.url}/:photoId`} render={this.renderGallery } />
</Switch>
不幸的是,它進入一個無限循環,導致match.url在重定向後永不改變。
有人可以幫助我嗎?謝謝
太謝謝你了! –