Gorakh Nath
Gorakh Nath

Reputation: 9828

How do I maintain react-redux state?

With react-redux all the data is contained in the store. How can I maintain the state that is stored in our store when, for example, opening multiple child tabs from a parent page or after a page refresh?

Upvotes: 1

Views: 324

Answers (1)

biofractal
biofractal

Reputation: 19123

The redux-localstorage-simple package does what you require. It is a redux middleware component that will automatically serialize redux state to local storage and restore that state, as redux initial-data, on startup.

The package also supports namespaces for the redux state trees it stores so this should allow you to clone distinct state-trees when creating new tabs.

Upvotes: 2

Related Questions