redux-dynamic-modules icon indicating copy to clipboard operation
redux-dynamic-modules copied to clipboard

Support for NextJs

Open milosCvetkovicDev opened this issue 6 years ago • 6 comments

Hi there,

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

Thanks! :)

milosCvetkovicDev avatar Dec 09 '19 10:12 milosCvetkovicDev

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

fostyfost avatar May 27 '20 14:05 fostyfost

@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.

kritika-agrawal-dunzo avatar Sep 16 '20 05:09 kritika-agrawal-dunzo

@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 from redux-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).

fostyfost avatar Sep 16 '20 15:09 fostyfost

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

kritika-agrawal-dunzo avatar Sep 22 '20 14:09 kritika-agrawal-dunzo

@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 avatar Sep 22 '20 15:09 fostyfost

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

fostyfost avatar Dec 06 '21 14:12 fostyfost