0

这是我卡片中的链接

<Link to={{
      pathname: `/detail/${props.movie.id}`,
      state: props.movie.id 
    }}>
... 
</Link>

这是我的路由器

<BrowserRouter >
        <Switch>
          <Route exact path="/" component ={HomePage} />
          <Redirect from='/detail/' to='/' exact />
          <Route exact path="/detail/:id" component={withRouter(Detail)}/>
        </Switch> 
</BrowserRouter>

当我点击我的卡片时,它改变了 URL 中的 ID 但我仍在当前页面上,没有任何变化,但如果我重新加载页面,一切都会好的

4

0 回答 0