路由和锚点定位有点像。被点击的a标签是锚点链接,跳转到的位置是锚点。
<Router>
<ul>
<li><Link to="/">首页</Link></li>
<li><Link to="/list/123">列表</Link></li>
</ul>
<Route path="/" exact component={Index}/>
<Route path="/list/:id" component={List}/>
</Router>
在这里<Link to="/">首页</Link></li>
是锚点链接,<Route path="/" exact component={Index}/>
是锚点