Search code examples
reactjsreduxnext.js

Is it possible not to use next-redux-wrapper in nextjs for Redux? Is Context+useReducer will be enough for state manager in NextJS apps?


I need a state manager in the NextJS application, and I use Redux. But when using it, I have to use a next-redux-wrapper and everything seems very complicated. There are those who say that the next-redux-wrapper does not work well and have some flaws and problems. And that in general, when it comes to NextJS, then it is not really needed Redux and it is enough to use the context. But context has its own problems with its rerenders. Help me to understand.I'm completely confused. What actually to use as state manager for NextJS apps?


Solution

  • You can use Redux in a Next app without next-redux-wrapper. Here's an example from vercel https://github.com/vercel/next.js/tree/canary/examples/with-redux.

    However, the next-redux-wrapper lets you avoid to instanciate the store every time you render on the server and other handy functionalities.

    In conclusion, if you are using Next for a static application, a simple redux-toolkit configuration is enough, otherwise consider using next-redux-wrapper.