React-Router
React Router 中有三种类型的组件: router components, route matching components,和 navigation components。
React-router-dom
router components
<Router>
Router 是所有路由组件共用的底层接口。通常,我们的应用程序将使用其中一个高级路由器代替:
<BrowserRouter>
<HashRouter>
<MemoryRouter>
<NativeRouter>
<StaticRouter>
最常见的使用底层的
<BrowserRouter>
<HashRouter>
<MemoryRouter>
<NativeRouter>
<StaticRouter>
route matching components
Route
没有路径总会匹配挂载,如果不需要请用Switch
以下所有的三种渲染方法都会通过三个相同的Route属性
- match
- location
- history