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
I have a specific use case, where I'm using redux-toolkit through module federation, so all my micro-frontends can access it. The problem is that every micro-frontend has its own React instance, and the exported hooks from the ReactModule won't work as we can't call one Hook from different React versions.
My current solution is basically copying and pasting the code from the buildQueryHooks and buildMutationHooks functions, but it would make everything way cleaner if the function buildHooks were available!
Thanks for reading
Edit: Already created a PR since it's a really small change: #3451
But you don't have half of the arguments for buildHooks available outside of the api.
Especially context is internal, and as we treat this api as internal, we will add any number of new arguments at any moment in time. Exporting the function would prevent us from doing that, and every new required argument we added would be a breaking change and need a new major release.
Hey @phryneas , thanks for the reply
I realized that once I actually tried to use it, sorry about it!
I updated my PR with some major changes. It seems that I also need to pass the specific React instance along with the redux functions from that instance as well. If no instance is set, then the default from peer dependency will be used.
I'm really not sure if there's a better way of handling this. Maybe this isn't even something scoped for the library, but since it solved my case, maybe it can help others as well.
Let me know what you think and please feel free to ask for any changes if this is relevant
I have a specific use case, where I'm using redux-toolkit through module federation, so all my micro-frontends can access it. The problem is that every micro-frontend has its own React instance, and the exported hooks from the ReactModule won't work as we can't call one Hook from different React versions.
My current solution is basically copying and pasting the code from the
buildQueryHooks
andbuildMutationHooks
functions, but it would make everything way cleaner if the functionbuildHooks
were available!Thanks for reading
Edit: Already created a PR since it's a really small change: #3451
RED-18
The text was updated successfully, but these errors were encountered: