I have 3 Apps written in react v18 and react-router v6 with module federation
host – with /home path
remote (app1) – with /app1 and /app1/create paths
remote (app2) – with /apps2 path
I want to be able
- route from host to remotes
- The apps will be isolated and not recognize other apps, so I can’t routing between nested routes on different remotes, for example If I’m on /apps2 and trying to refer /app1/create I want to get not found page
expectations
- this was something that worked out of the box with react router v5 by creating differentBrowserRouter on host and the 2 remotes, but with react router v6 I’m getting this error Uncaught Error: You cannot render a <Router> inside another <Router>. You should never have more than one in your app.
Question – I suppose react router v6 broke this behaviour for a reason, would like to understand why
- Something similar to here, create on the host BrowserRouter and in the remotes MemoryRouter and update each other by sending an events and listen to them
Question – Is there more neat solution for nested routes with isolated remotes?
New contributor
Gal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.