I’m I the only one who struggle with NextJS 13 App Router hydratation?
- next-redux-wrapper no longer works with NextJS 13 App Router (https://github.com/kirill-konshin/next-redux-wrapper/issues/564)
- redux-toolkit documentation, explain well how to setup redux with NextJS 13 but end result is not performant
The Solution
Fetch data along server side render, and load it in redux state at first render.
pnpm add use-hydrate
yarn add use-hydrate
npm i use-hydrate
GitHub - samuelint/use-hydrate: Nextjs 13 App Router easy redux hydratation
Usage example
Here’s the code, (if you do not want to add the lib).