rt2zz / redux-persist

persist and rehydrate a redux store
MIT License
12.91k stars 863 forks source link

Why persistence works without <PersistGate> #1333

Closed ablaszkiewicz closed 2 years ago

ablaszkiewicz commented 2 years ago

Hello. I am integrating redux-persist with next-js and following a simple, straight forward tutorial which I did in previous project and before finishing last step (which was to wrap everything with PersistGate) just out of curiosity I checked what would happen without it.

And guess what. Everything works fine. Data is persisted between reloads. abc

(Works without underlined code fragments) Can someone explain it to me? Why does it work?

greg-wb-ap commented 2 years ago

It is to stop a flash of "initial state" between the server load of the page and the retrieval of state from the storage layer.

ablaszkiewicz commented 2 years ago

Oh thank you. Makes sense now.