Open quicksnap opened 6 years ago
your example gives the folowing warning, proxyConsole.js:72 Warning: As of React Final Form v3.3.0, props.mutators is deprecated and will be removed in the next major version of React Final Form. Use: props.form.mutators instead. Check your ReactFinalForm render prop. on your current example gives the answer.
this might gives the anwer ;) --> Use: props.form.mutators instead.
also the combination of a decorator and a mutator could give you what you want. use the decorator to detect the change see calculate example.. and use the mutator there to trigger the actual state change.
@quicksnap
You can add the form
parameter to the render method
render={({ mutators, handleSubmit, reset, submitting, pristine, values, form })
Then you can used like that
form.mutators.ding()
Cheers
@mariano-aguero thank-you just what i needed to get rid of the warning; But in your example, you don't need to pass mutators as a parameter, since you are already passing the form parameter.
Are you submitting a bug report or a feature request?
Bug!
What is the current behavior?
When you trigger a mutator within FormSpy.onChange, it will throw a few setState warnings on mount
What is the expected behavior?
Bunnies.
Sandbox Link
Example: https://codesandbox.io/s/qvvn0zr5oq
Other information
What I am trying to accomplish is form re-population. I would like to fill in the form with previous values if a user refreshes the page, or temporarily navigates away. I can't use
initialValues
, since I still want the form to be able to reset back to its pristine state.I figured I would make a mutator that just populates, but now I came across the
initialize
function.. and now I'm seeing your "Load, Save, Reinitialize" example... sooo I'm going to explore those options.However, this still seems to be a bug..?