|
|
|
|
|
by positivecomment
3313 days ago
|
|
Is there special logic in react that binds arguments of a function to the props with the same name? I'm talking about the handleDelete "fix" in the article: render() {
const views = this .props.dataList.map((d, i) => {
return <Data data={d} index={i} onDelete={this.handleDelete} />
});
}
handleDelete(index) {
//...
}
I guess they just call that function from within the Data component with the correct parameter. But then, Data component needs to know how to call that function. Is there a better way? |
|
[1] https://facebook.github.io/react/docs/handling-events.html
[2] https://babeljs.io/docs/plugins/transform-class-properties/