blog
blog copied to clipboard
react router v5 使用history 模块,控制路由
react router 核心 就是使用 history 模块。
so..
可以在 其他需要访问控制路由的地方
var history = require('history');
// 如果你的路由是: example/some/path 这样真实的 URL
import { createBrowserHistory } from 'history'
const history = createBrowserHistory()
// 如果你的路由是 :example/#/some/path
import { createHashHistory } from 'history'
const history = createHashHistory()
history.push(example/some/path)