OnClick react-table component for column
I am using the "response-table" component https://react-table.js.org
I want to add a click event for one column (I will open a modal info display based on this event later).
+3
source to share
2 answers
You add getTrProps to the ReactTable like in the example:
const onRowClick = (state, rowInfo, column, instance) => {
return {
onClick: e => {
console.log('A Td Element was clicked!')
console.log('it produced this event:', e)
console.log('It was in this column:', column)
console.log('It was in this row:', rowInfo)
console.log('It was in this table instance:', instance)
}
}
}
<ReactTable data={[]} columns={[]} getTrProps={onRowClick} />
+8
source to share