Closed tsabolov closed 7 years ago
you want to "control" the form value directly in that case. Instead of using defaultValue
use value
and onChange
, store the current form value in state, and then you can update that value from outside the Form
Oh, I see. Thank you for super fast response!
I have implemented a component whose
render
method renders react-formal'sForm
. The basic structure is as follows:Then I call the component with data (actually the data comes from a Redux store), like this:
The problem is that when I am adding a new item to
choices
array (via Redux action/reducer) and thedata
prop ofMyComponent
changes, theForm
does not get the updated value. It just sticks with the previous one.What is the right way of implementing of such a logic with
react-formal
?