路由模式
- BrowserRouter与HashRouter
- BrowserRouter 没有#的路径
- HashRouter 有#路径
举个栗子
import React from 'react'
import { BrowserRouter, HashRouter, Redirect, Route, Switch } from 'react-router-dom'
export default function App() {
return (
<BrowserRouter> //BrowserRouter路由模式 可以更换 HashRouter模式
<Switch>
<Route></Route>
</Switch>
</BrowserRouter>
)
}
标签:BrowserRouter,ReactRouter,模式,HashRouter,import,路由
From: https://www.cnblogs.com/bingquan1/p/16954092.html