avkonst/hookstate

Local Persistence at Global-State Level (Feature Request)

waleedshkt opened this issue · 6 comments

I believe devs would love to see a plugin that attaches at createState (global-state) level.

One such plugin is hookstate-persist. But it has little to no documentation on how states are hydrated and at what frequency does the plugin remain in sync with frequently mutating global states.

So a persistor that gives the option to include engines like AsyncStorage or react-native-encrypted-storage, attaches nicely with multiple createStates and has callback functions that one can use to listen for state hydration completion will be really great.

Localstored extension for hookstate 4 does the job. You might extend it for react native

Awesome. It'd be great to then add in the docs how to use it with createState. Only example provided is apparently at local level using useHookState

documented now

Really awesome!

I felt this need of provisioning of your desired storage-engine instance as browser local-storage was making Localstored plugin incompatible with react-native applications.

Anyways, greatly appreciated.

Storage engine option was contributed. If it does not meet react native needs, we can rethink. The extensions are quite simple. You can suggest some implementation and we can convert it to a standard extension