Wrapper doesn't support Next 14
jarriaza-102 opened this issue ยท 4 comments
Describe the bug
useRouter
hook gotten from next/router
is throwing errors while working with Next 14, development server is going alright, it's just whenever build process take place and run the built version of the code.
This file in next-redux-wrapper is using next/router
, and that's outdated for Next 14.
There's a file on Next 14 that is throwing an error when router doesn't exist, and the router gotten from next/router
is the guilty of that, there should be a migration to next/navigation
.
To Reproduce
Update to Next 14 and wrap component with reduxWrapper.withRedux
.
Expected behavior
Wrapper should run with Next 14, I think problem is also on Next >= 13.5
Desktop (please complete the following information):
- OS: Mac OS 14.0
- Browser Console
- Version 8.1.0
Additional context
I did a change in my node_modules
folder removing the code that is using useRouter
from next/router
, and it works just fine!
Also there's no way to use redux-wrapper with generateStaticParams
.
I have the same problem and I am looking for a perfect solution. Is there a perfect solution to solve this problem? @jarriaza-102
I have the same problem and I am looking for a perfect solution. Is there a perfect solution to solve this problem? @jarriaza-102
I don't think there's a "clean" solution for this, I would say the code in the library should be changed to not use the outdated code.
I have the same problem and I am looking for a perfect solution. Is there a perfect solution to solve this problem? @jarriaza-102
I don't think there's a "clean" solution for this, I would say the code in the library should be changed to not use the outdated code.
To deal with this, I created a new repository, upgraded it based on Next-redux-wrapper, upgraded both react and next, and still passed all the original tests. At present, my own project has been connected to next-redux-wrapper-future development. Consider giving it a try to see if it solves your problem.
I have the same issue and, if I interpreted correctly, the App Router architecture doesn't work with next-redux-wrapper but only Pages Router architecture works with it.
From the Redux official doc it says:
The Pages Router is the original architecture for Next.js. If you're using the Pages Router, Redux setup is primarily handled by using the next-redux-wrapper library, which integrates a Redux store with the Pages Router data fetching methods like getServerSideProps.
And for App Router it explains the steps to follow:
https://redux.js.org/usage/nextjs