Ariel Rahmane
Ariel Rahmane

Reputation: 101

How can I cache Redux states? (without redux-persist)

Problem

I want to save data in the store with Redux, like tokens and user-related data to be used across the whole application (I'm using React).

The problem is that Redux does not persist in the state when refreshing a page.

Thoughts

Maybe I'm missing some core Redux or React concept? It feels a bit crazy for me not to be able to find a go-to package (or any other method) just to save a piece of data and be able to access it across the whole application without resetting on refresh :/

Upvotes: 0

Views: 362

Answers (2)

phry
phry

Reputation: 44186

Redux-persist doesn't need to be very active - it works for half a decade now and there is just no need for a lot of changes. It works.

It is the to-go-package for that purpose.

Upvotes: 1

try to save your Redux states in localStorage

Upvotes: 1

Related Questions