How to Expose React Router with Module Federation? #4253
Unanswered
AshanPerera98
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have an old React component that has been exposed as a UMD library that contains a router. Currently, it is consumed by a parent React application and renders within an iframe as a micro frontend. I want to change the UMD component and expose it as a module federated component so that parents can consume it remotely.
The problem is I want to expose the router component as the remote entry.
I tried to use a state to flag the path and based on that used a switch case statement to conditionally render the react components but the problem is I have attached the Redux store to the router using react-router-readux and used the history object to navigate in some places. That functionality cannot be fulfilled by the switch case approach.
Is there any way I can overcome this issue or is there any other available better approach I can do this?
Beta Was this translation helpful? Give feedback.
All reactions