microsoft / redux-dynamic-modules

Modularize Redux by dynamically loading reducers and middlewares.
https://redux-dynamic-modules.js.org
MIT License
1.07k stars 116 forks source link

Support for NextJs #117

Open milosCvetkovicDev opened 4 years ago

milosCvetkovicDev commented 4 years ago

Hi there,

Can I use this awesome package with NextJs and if i do can you share some exam?

Thanks! :)

fostyfost commented 4 years ago

Hey. Take a look at my example of using NEXT with dynamic modules. https://github.com/fostyfost/next-with-redux-dynamic-modules

kritika-agrawal-dunzo commented 3 years ago

@fostyfost can you please explain what are you doing here? As I checked in your code, you are not using createStore exported from redux-dynamic-modules.

fostyfost commented 3 years ago

@fostyfost can you please explain what are you doing here? As I checked in your code, you are not using createStore exported from redux-dynamic-modules.

Hello, @kritika-agrawal-dunzo

Quite right, I don't use createStore by default. I have implemented my own based on createStore fromredux-dynamic-modules. All this is needed in order for the rest of the redux-dynamic-modules library to work properly in server-rendered conditions (Next.js SSR).

kritika-agrawal-dunzo commented 3 years ago

@fostyfost Thanks for the response :) One more doubt, is there any particular reason for not using next-redux-wrapper?

fostyfost commented 3 years ago

@kritika-agrawal-dunzo Unfortunately, I don't remember all the problems I faced when I tried to use the next-redux-wrapper. You can try using this library. It definitely does not suit me, for example, because the store was created twice on the server.

fostyfost commented 2 years ago

Hello everyone! I've updated my example to work with Next.js. It is now a complete library. You can try it in your Next.js projects. https://github.com/fostyfost/redux-eggs