React js onClick can’t pass value to method
Easy Way Use an arrow function: return ( <th value={column} onClick={() => this.handleSort(column)}>{column}</th> ); This will create a new function that calls handleSort with the right params. Better Way Extract it into a sub-component. The problem with using an arrow function in the render call is it will create a new function every time, which … Read more