Mobx react-router-dom
yarn install history @aomi/mobx-history
import { createHashHistory } from 'history';
const history = syncHistory(createHashHistory());
const App = (
<Router history={history}>
</Router>
)
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');