I am new on react, when I am trying to pass data form onSelectionChange
property but when I try to apply it the selection of the table stop working
const [selectedRows, setSelectedRows] = React.useState([]);
const handleSetSelectedRows = (e) => {
setSelectedRows(e);
};
...
<MaterialTable
...
onSelectionChange={(e,a)=>{
handleSetSelectedRows(e);
}}
/>
What is the problem?
use useRef
instead of useState
because it rerender the table