"react-router-dom": "^4.2.2"
具体的代码如下:
//父组件代码
import { Router, Route } from 'react-router-dom'
<Router history={customHistory}>
<App>
<Route exact path="/" component={Home}/>
<Route path="/city" component={City}/>
<Route component={NotFound}/>
</App>
</Router>
//Home子组件代码
<Link to="/city"></Link>
在子组件中点击Link, 浏览器上方的url会改变, 但是页面内容不会更新,若手动刷新页面,内容才会跟更新
搜到说去掉 App 就可以正常。原因是?若是不去掉需要怎么处理