Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persist state #57

Open
GerardKetuma opened this issue Jan 17, 2020 · 3 comments
Open

Persist state #57

GerardKetuma opened this issue Jan 17, 2020 · 3 comments

Comments

@GerardKetuma
Copy link

How do you persist state when using remx? Any pointers will be great. Thanks

@andykog
Copy link
Collaborator

andykog commented Feb 20, 2020

@GerardKetuma, remx doesn't provide any built-in tools for that. You can make some helper that serializes & saves your stores data and manually call it after setting new values.

@dancomanlive
Copy link

dancomanlive commented Aug 20, 2020

Just use reactn + reactn-persist ;)

@andykog
Copy link
Collaborator

andykog commented Dec 9, 2020

This feature is requested multiple times already. We can discuss API that would be suitable for data persistence. I can imagine something like:

remx.persistState({
  storage: AsyncStorage, // localStorage, sessionStorage or any instance with Storage API interface support.
  debounceDelay: 1000, // Persist debounce delay. Default 1000ms.
  key: '@my-store',
  dehydrate: () => ({products: myStore.products, data: myStore.data}),
  rehydrate: ({products, data}) => {myStore.products = products; myStore.data = data;},
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants