reactjs - How to update uncontrolled / readonly input value from parent component? -
i have simple textfield (<input type="text"/>
) component (child component) should show value gets parent component. readonly
, user cannot change value.
my problem textfield rendered once right value not update value in parent component changes. value stays same although render
method called each time parent component changes state
(check console).
here jsfiddle demonstrate problem.
any ideas how solve problem?
you should use value
prop instead of defaultvalue
. here's updated jsfiddle.
Comments
Post a Comment