expose navigate method by call defineRouterConfig function
You may need to call route jumps outside of React applications
For example: Global registration of sub applications in qiankun.js
import { registerMicroApps } from 'qiankun';
import { defineRouterConfig, MRouter} from 'react-router-manage'
const routerConfig = defineRouterConfig({
...
}}
registerMicroApps(
[
{
name: 'app1',
entry: '//localhost:8080',
container: '#container',
activeRule: '/react',
props: {
navigate: (url) => {
// This type of jump can also have routes guards, query and params extension,
routerConfig.navigate(url);
},
},
},
]
);
const App = () => {
// After initialization here, we will assign the value of routerConfig.navigation
return <MRouter routerConfig={routerConfig} />
}