Proposal: useFormPersist
hook
#1806
Unanswered
mahmoud-alaa1
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I think it would be really helpful to have a simple way to persist form state in TanStack Form.
Right now, if you want your form data to survive a page reload or app restart, you have to manually subscribe to form changes, save them to
localStorage
orAsyncStorage
, handle debounce, exclude sensitive fields, and restore them again when the form mounts. It’s doable but super repetitive and easy to mess you.My idea is adding an optional hook called useFormPersist(form, key, options) that automatically saves and restores form values.
It could work on both web and React Native.
Example
Suggested Design
It would just:
Beta Was this translation helpful? Give feedback.
All reactions