arrays - How to get all labels from the state REACTJS -
i have form created dynamically (not sure how created) know have clear form.
what have done sone far:
... resetform: function() { this.updatevalue('id', ''); this.updatevalue('field_1', ''); this.updatevalue('field_2', ''); this.updatevalue('field 3', ''); this.updatevalue('field4', ''); }, ...
i know don't want have manually type in each field name. know in console can this.state.fields
, array of objects. label element each array value.
thanks
you should able
resetform: function() { (var = 0; < this.props.fields.length; i++) { this.updatevalue(this.props.fields[i].label, ''); } },
i hope helps:
happy hacking
Comments
Post a Comment