@aomi/mobx-history
v1.0.4
Published
Mobx react-router-dom
Downloads
3
Readme
Mobx history
Mobx react-router-dom
快速开始
安装
yarn install history @aomi/mobx-history
React Router 使用
import { createHashHistory } from 'history';
const history = syncHistory(createHashHistory());
const App = (
<Router history={history}>
</Router>
)
Api
import { navigationServices } from '@aomi/mobx-history';
export interface Location<S = LocationState> {
pathname: Pathname;
search: Search;
state: S;
hash: Hash;
key?: LocationKey;
}
const location:Location = {}
// 进入指定页面
navigationServices.push(location)
// 替换当前页面
navigationServices.replace('/login');