ReactContext between exposed components #2146
Unanswered
matthintosh
asked this question in
Q&A
Replies: 2 comments
-
For context ensure the context modules are shared as singletons. Or their dependencies. Usually I would suggest recoil or jotai, since it's atomic and can be shared as a singleton and atoms can be shared between apps too |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thank you very much for your answer. Unfortunately It's not working on my situation. I have 2 applications :
I will try using recoil or Jotai. Thank you ! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I'm using the module federation to develop a web-application based on micro-front components. First, thank you a lot for this awesome plugin that help me a lot to achieve my application.
I'm facing a situation in which I can't explain why this react context is not shared between components.
I have a host application and a remote. The host application load an expose a component in which I have a context provider. The exposed component has children that are also exposed and loaded from the host application. My issue is that children can't access to the react context. React mentioned that this child exposed component must be under the context.
From your samples, you are loading the context in the host app and sharing it to exposed components. It's totally working with Apollo and Redux (I'm using both) to share Apollo client to exposed component. But my problem is a little bit different since I want to initialize the react context from an exposed component to another exposed components loaded by the host app.
Actually it's not working. Does Module Federation support this ? Am I doing something very wrong ?
Thank you for your help !
Beta Was this translation helpful? Give feedback.
All reactions