Replies: 2 comments 2 replies
-
Could you provide a repo demonstrating the problem |
Beta Was this translation helpful? Give feedback.
-
hey @wowblvck Cross-App Routing with Module Federation and React Router v6 1.Centralized History: 2.Shared Router: 3.Central Routing Setup: example:
2.import { unstable_HistoryRouter as HistoryRouter } from 'react-router-dom'; const App = () => ( 3. 4.import history from 'hostApp/history'; This keeps navigation in sync across micro-apps as a single Single page application. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello. The documentation offers many examples (thank you very much for that) on using MF in various configurations and across different stacks. However, I haven’t been able to find a solution to the problem I’m interested in (maybe I was just inattentive, or perhaps there’s simply no solution).
In our products, we use
React
andReact Router DOM v6
. We now need to combine them into a single SPA to enable sharing components and states. I found numerous instructions describing the possibility of a global shell and managing routing through it, but I didn’t find any mention of the possibility of navigating from one application to another.For example, I have two applications using
RSBuild
and MF 2.0, and I’m also using MF Bridge React. Each application creates routes withcreateBrowserRoute
. The applications are exported and connected to the host application, which also hasReact Router DOM v6
. Navigation through the Shell application works perfectly, but what about navigating from one application to another? If I have a link in Remote 1 (e.g., /dashboard) to Remote 2 (e.g., /profile), and I try to navigate using or navigate("/profile"), the routing only works within the context of Remote 1. Are there ways to make all applications work as a single SPA with cross-application routing?It would be great if someone could share a solution or tutorial on how to achieve this.
Beta Was this translation helpful? Give feedback.
All reactions