Crispen Smith
Crispen Smith

Reputation: 533

Save multiple Redux states

In developing my app I have been asked to create a save and restore functionality where the restore would provide a menu of previously stored states.

Ie. before the first save, restore is not possible. After the first save Restore provides a link that will rehydrate to exactly that state. The user should be able to indicate a name for that saved state that would appear in the "restore" menu.

I feel like localStorage becomes a critical piece of this and had originally hoped that redux-storage would be part of the solution. From what I can tell, the Redux-Storage pattern is primarily about persistence, not serialization with keys. Significant googling hasn't shown me any other modules that would work.

Is there an established pattern/module for solving this pattern.

Upvotes: 0

Views: 36

Answers (1)

SrThompson
SrThompson

Reputation: 5748

The Command pattern. The classic example for its use case is implementing undo/redo functionality. It also lends itself nicely to redux's action -> state data flow

Upvotes: 1

Related Questions