如何知道是否在Onrowselect方法中选择了该行?
import MUIDataTable from "mui-datatables";
...
const [ total, setTotal ] = useState(0);
...
const handleRowSelect = (curRowSelected) => {
console.log(curRowSelected);
const val = credits[curRowSelected[0].index].amount;
// I want to add a condition: IF selected, I'll add value to my total variable; otherwise, I'll subtract
}
const options = {
filterType: 'dropdown',
pagination: false,
onRowsSelect: handleRowSelect
};
...
<MUIDataTable
title={"Payments"}
data={credits}
columns={columns}
options={options}
/>
isRowSelectable