kirill-konshin/next-redux-wrapper

Usage with Next.js 13?

Jdyn opened this issue ยท 8 comments

Jdyn commented

Is your feature request related to a problem? Please describe.
Are there plans to include a migration guide to setup with Next.js 13 app directory? It looks like Next.js introduced changes that eliminate _document and _app when using the new file structure.

Describe the solution you'd like
A migration guide to get it working with Next.js 13

@kirill-konshin
Are there currently any plans or maybe workaround we could use?

Any update on this ?

This library will not work with new app structure. In fact, app structure makes redux usage really awkward and I do not recommend to do it. Since any server component can dispatch actions on server side, we will have to constantly sync redux state from server to client, which I find awkward.

My recommendation would be to clearly separate server state from client state and only update server state on server and redux (client) state on client. You will save yourself a lot of hours on not doing debugging of mixed state ;)

@kirill-konshin does this mean that this package will most likely become obsolete going forward since this is the direction Next is going in?

It think it would be better to mention this in readme file that this package will doesn't fit with app Directory, this would also save people a lots of hours.

So far there is no clear way to use Redux with Server Components...

First of all, components that use Redux needs a Provider up in the tree in order to work, and Provider is using Context, which is not available on server (yet?).

With that said, I suggest to keep Redux as client component ("use client"), and keep server-side state outside of Redux.

This library will not work with new app structure. In fact, app structure makes redux usage really awkward and I do not recommend to do it. Since any server component can dispatch actions on server side, we will have to constantly sync redux state from server to client, which I find awkward.

My recommendation would be to clearly separate server state from client state and only update server state on server and redux (client) state on client. You will save yourself a lot of hours on not doing debugging of mixed state ;)

why redux usage is awkward?

Any update on this issue? How to use this package with Next js v13