module-federation / module-federation-examples

Implementation examples of module federation , by the creators of module federation
https://module-federation.io/
MIT License
5.68k stars 1.76k forks source link

redux and redux-saga integration with nextjs paid plugin #1079

Closed AminAshtiani closed 2 years ago

AminAshtiani commented 3 years ago

Hi

first of all, I want to appreciate everyone who is participating in this useful tool. I bought the paid plugin for next, but actually, I need to use redux and redux-saga in some of micro frontends. I follow the redux injection solution but it failed.

I want to know that : 1- is it a good way to use redux in a Nextjs application? is it an anti-pattern or not? 2- how can I integrate reducers and middleware with host app? should I expose them and use them as remote in host? or I should do something else?

ScriptedAlchemy commented 3 years ago

You'd need to use the low level api and maybe top level awaits on dynamic imports of redux itself so it can be shared

AminAshtiani commented 3 years ago

You'd need to use the low level api and maybe top level awaits on dynamic imports of redux itself so it can be shared

hi there

actually I integrated redux and redux-saga like your example in this repo. I mean that I shared store from host to all microfrontends and asynchronously added all reducers and sagas to the store. and it works fine! but what did you mean by low level API?

ScriptedAlchemy commented 2 years ago

Oh perfect! The low level api is using window.get or init. However I'm about to release new support that allows for federation to be well integrated inside of next