Select row on click react-table

I found the solution after a few tries, I hope this can help you. Add the following to your <ReactTable> component: getTrProps={(state, rowInfo) => { if (rowInfo && rowInfo.row) { return { onClick: (e) => { this.setState({ selected: rowInfo.index }) }, style: { background: rowInfo.index === this.state.selected ? ‘#00afec’ : ‘white’, color: rowInfo.index === this.state.selected … Read more