Repository URL to install this package:
|
Version:
6.1.0 ▾
|
import { observable, action } from 'xmobx/mobx'
export class RouterStore {
constructor() {
this.location = observable(undefined)
this.history = observable(undefined)
}
@action
_updateLocation(newState) {
this.location = newState
}
/**
* --------------
* history methods
*/
push = location => {
this.history.push(location)
}
replace = location => {
this.history.replace(location)
}
go = route => {
this.history.go(route)
}
goBack = () => {
this.history.goBack()
}
goForward = () => {
this.history.goForward()
}
}