3
rated 0 times
[
9]
[
6]
/ answers: 1 / hits: 22965
/ 10 Years ago, sat, may 3, 2014, 12:00:00
I am aware that dynamic children of a component must have a unique key
as the following (modified example from official docs):
render: function() {
var results = this.props.results;
return (
{results.map(function(result) {
return <ChildComponent type=text key={result.id} changeCallback={this.props.callbackFn}/>;
})}
);
}
Considering that ChildComponent
is another React component nested here, with a render
method as bellow
render: function() {
var results = this.props.results;
return (
<div className=something>
<input type=text onChange={this.props.changeCallback} />
</div>
);
}
is there any way to access the key when callbackFn(event)
is called?
More From » reactjs