I provide a collection of input elements for objects in the array.
rendere: function () [Var range = []; This.props.ranges.map (function (category, index) {var category element = & lt; input type = "text" value = {range.name} onChange = {this.changeRangeName.bind (this)} /> ; Category Push (Range Element);}, this); // render categories}
This allows me to write to the child handler function:
changeRangeName: function (event) {var newName = event. Target.value; },
But in this handler I need the Range Object ID which I want to change. That's why I can change the change in how I create an input element in the Render function and change:
var rangeElement = & amp; Input type = "text" value = {range.name} onChange = {this.changeRangeName .bind (this, range.id)} />
Now my handler will receive range.id as a parameter but now I do not have a new name value. I can use it RIFE
var rangeElement = & lt; Input type = "text" ref = {'range' + range.id} value = {range.name} onChange = {this ChangeRangeName.bind (this, range.id)} />
This is the only solution I know but I suspect is better.
event
argument has still been passed, but category IID is included in the logic argument list, so your
changeRangeName
method will appear like
changeRangeName: function (category IED, event) {var newName = event .target.value; },
see
No comments:
Post a Comment