I know I can pass param like the following
someList.map((column) => {
return (
<th value={column} onClick={() => this.handleSort(column)}>{column}</th>
)
})
However it is also advised not to use arrow function or bind because that leads to unneccessary render
(edit: I think it means the component with the binded function as a prop gets re-rendered when parent component renders because functions are getting created every time when parent component renders)
But then I've not seen any other way to do it without creating a new function with bind
, or arrow function
.
Maybe you could create binded functions for all the items in the list, but I don't think it is feasible when you get data from props (so you can't pre-create binded functions in a constructor ?
Edit:
https://github.com/facebook/react-native/issues/7892 talks about getting component being clicked.
I guess there's no recommended public way of doing this as of now at least for react-native.