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

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -