Open wenqili opened 5 years ago
Handling Events and pass value ES 6 arrow function
// bind in constructor constructor() { this.handleClick = this.handleClick.bind(this) } handleClick(col){ ... } return ( <th value={column} onClick={() => this.handleClick(column)}>{column}</th> );
ES5
handleClick(col){ ... } return ( <th value={column} onClick={() => this.handleClick.bind(this, column)}>{column}</th> );
Or create sub-component to prevent extra re-renders link
Handling Events and pass value ES 6 arrow function
ES5
Or create sub-component to prevent extra re-renders link