Skip to content

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

@aototo

Description

@aototo

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions