Closed
Description
I have a question about react/jsx-no-bind
rule in 3.0.0
: how can I pass args to handler from callback if I can't use bind and arrow functions?
doSomething(thing) { ... }
render() {
const { items } = this.props;
return (
<ul>
{
items.map(item => (
<li onClick={this.doSomething.bind(this, item)} /> // <--- JSX props should not use .bind()
<li onClick={() => this.doSomething(item)} /> // <--- JSX props should not use arrow functions
))
}
</ul>
);
}
Metadata
Metadata
Assignees
Labels
No labels