wsmd/react-use-form-state

Reset form (not clear form)

tenpercentelvis opened this issue · 1 comments

Having a reset method which resets (not clears) everything including error, touched etc to the original values.

I pre-fill a form (settings) with values from the db using the default state. The user can change fields but also reset changes. The current clear method clears all the preset values instead of resetting to the original values.

The work around I'm using is to update the key to re-render the form but its a bit slow to re-render... e.g. from #33 https://codesandbox.io/s/x3kznwm6lo

Related to:
#33 (reset form)

Would it also be possible to set the values of the form? I'm loading my data asynchronously and when the data arrives I use setField() to put values in the form. This however marks every field as touched.