How does react-router4.2 (up to date) have programmatic navigation and navigation guards like vue-router?

how to do the following two ways
-programmatic navigation-

router.push ({name: "user", params: {userId: 123}})

/ / with query parameters, change to / register?plan=private
router.push ({path: "register", query: {plan:" private"}})

-Navigation guard-
const router = new VueRouter ({.})

router.beforeEach ((to, from, next) = > {
/.
})

=


this.props.history.push ('/ xx')


have you solved it? I also need to do some preprocessing before jumping


window.location.href ='/ user/login'

.
Menu