我在使用下面的变量.
var newInput = {
title: this.inputTitle.value,
entry: this.inputEntry.value
};
这是我的输入字段使用的.
<input type="text" id="inputname" className="form-control" ref={el => this.inputTitle = el} />
<textarea id="inputage" ref={el => this.inputEntry = el} className="form-control" />
<button className="btn btn-info" onClick={this.sendthru}>Add</button>
激活{this.sendthru}
后,我想清除输入字段.然而,我不确定如何做到这一点.
此外,如本例所示,有人向我指出,我应该使用ref
属性作为输入值.我不清楚的是{el => this.inputEntry = el}
到底意味着什么.在这种情况下,el
的意义是什么?