Search code examples
react-final-form

Change value of React final form Field, when state of outer component changes


I am trying to change value of react-final-form Field, whenever event from outer component occurs. Let´s say I call server API, which eventually changes state object. This object was the initialValues for an origin form, but of course Form has its own state managment, so changing this outer state doesnt affect the Field´s value.


Solution

  • I'm not 100% sure I understand the use case, but if you change the value passed to <Form/>'s initialValues prop, the form will reinitialize to those values.