blog icon indicating copy to clipboard operation
blog copied to clipboard

react router v5 使用history 模块,控制路由

Open aototo opened this issue 6 years ago • 0 comments

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)

aototo avatar Aug 27 '19 12:08 aototo