dananw / next-with-redux-toolkit

Simple implement Redux Toolkit in Next js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Initialize Store with initialState

neilpoulin opened this issue · comments

Hi, Thanks for this example repo. It's pretty helpful. However, there seems to be something missing: hydrating the store with an initial state.

In the lib/with-redux-store.js file, there are several references to initializeStore(initialState) however the function definition doesn't take any arguments, so nothing happens with the initialState. Any thoughts on how this should work with an initial state?

hi bro, if you want to initialState you can change it on this file

for hydrating and persist you can create a custom function to save the last value to local-storage, if you don't want to bother you can use lib https://github.com/rt2zz/redux-persist