You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our application we have split the main app into smaller apps and then can import each app as a component via module federation. So for example we have an admin app which uses its own BrowserRouter when running in isolation:
Which looks to work fine... however this means we can't expose the routes via module federation as that deals with exposing components and not exposing a set of routes... is there anyway to get around this?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In our application we have split the main app into smaller apps and then can import each app as a component via module federation. So for example we have an admin app which uses its own
BrowserRouter
when running in isolation:Admin App - index.tsx
Admin App - App.tsx
But when we're running the core app we import the App itself (so we don't have nested BrowserRouter's):
Core App - index.tsx
This works great for us... however we're looking at moving to a Data Router like so:
App - index.tsx
However the use of the
Routes
components prevents all nested routes from being Data Routes as per the documentation: https://reactrouter.com/en/6.23.0/components/routesAdmin App - App.tsx
One solution is to export a set of routes instead of a component like so:
Admin App - App.tsx
And then use them like this:
App - index.tsx
Which looks to work fine... however this means we can't expose the routes via module federation as that deals with exposing components and not exposing a set of routes... is there anyway to get around this?
Beta Was this translation helpful? Give feedback.
All reactions