DEV Community

Discussion on: Simplest way to persist redux state to localStorage

Collapse
 
ph1109ji profile image
Phuoc the Pearl

Dev.to is always very helpful indeed.
But I have a question, can I only save to localStorage ONE STATE SLICE rather than an entire redux store? I think storing an entire redux store will cost much perfomance whereas I only need to store one state slice.

Collapse
 
cyberwombat profile image
Yashua

Yes you can save only a slice such as: saveState(store.getState().mySlice