Closed adriaanwm closed 4 years ago
If you want to PR this, I'd accept. But, I'd like to deprecate in favor of a hook based approach.
Also, I'd waffle on calling this a bug. Forms usually control their own data, under 1 form. Including data from outside of the form UI is more of an enhancement than a bug. For instance, this is not supported by redux-forms.
@adriaanwm In the future (or if you want to migrate), this use-case is handled by the preProcess
prop for useForm
Say I have
myForm
and have some dynamic value that is from an element outside of the form (like a list of items with checkboxes that you're selecting). I assumed I could just set the state at['myForm', 'values', 'myField']
to that value and it would get included in onSubmit. Unfortunately, form usesto keep store updated with local state, and this erases the value I set for
myField