Skip to content

v2.0.4

Latest

Choose a tag to compare

@onshinpei onshinpei released this 16 Apr 05:51
· 8 commits to main since this release
c80c307

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} />
}