@module-federation/bridge-react
provides bridge
utility functions for React applications. The createBridgeComponent
function can be used to export application-level modules, while createRemoteComponent
is used to load application-level modules. Demo
After using @module-federation/bridge-react, you should not set react-router-dom as shared; otherwise, the build tool will raise an exception. This is because @module-federation/bridge-react controls routing by proxying react-router-dom.
Remote
Host
options
loader
() => Promise<Module>
loadRemote('remote1/export-app')
, import('remote1/export-app')
export
string
loading
React.ReactNode
fallback
ComponentType<{ error: any; }>
(props: PropsInfo) => React.JSX.Element
bridgeInfo
{ rootComponent: React.ComponentType<T>; }
() => { render: (info: RenderFnParams) => void; destroy: (info: { dom: HTMLElement }) => void; }