react-router-dom
route路由
router路由器
// React-Router
<Link className="list-group-item" to="/about">About</List>
<Route path="/about" component={About}/>
import {BrowserRouter} from 'react-router-dom'
<BrowserRouter>
<App/>
</BrowserRouter>
<HashRouter></HashRouter>
- 明确好界面中的导航区,展示区
- 导航区的a标签改为Link标签
<Link to="/xxx">Demo</Link>
- 展示区写Route标签进行路径的匹配
<Route path="/xxx" component={Demo}/>
<App>
的最外侧包裹了一个<BrowserRouter>
或<HashRouter>