I want to make the row icon I click collapsible and display data. Presently if any of the row in table is clicked, it displays the collapsible content for all the rows.
{data.map((dataRow) => (
<TableRow
key={dataRow.id}
title="tableRow"
className={classes.tableRow}
>
<TableCell className={classes.tableCell}>
<IconButton size="small" onClick={() => setOpen(!open)}>
{open ? <ArrowDropDownIcon /> : <ArrowDropUpIcon />}
</IconButton>
{dataRow.id}
<Collapse in={open} timeout="auto" unmountOnExit>
<Box margin={1}>
<Typography variant="h6" gutterBottom component="div">
History
</Typography>
</Box>
</Collapse>
</TableCell>
<TableCell className={classes.tableCell}>
{dataRow.name}
</TableCell>
<TableCell align="left" className={classes.tableCell}>
{dataRow.lastName}
</TableCell>
</TableRow>
))}
</TableBody>