How to pass value of ‘row‘ to EditRecord (child file)? Once I’m on EditRecord page, the props (record) of the parent’s file’s gone.
Parent File:
const [record, setRecord] = React.useState({});
return (
<TableBody>
{stableSort(props.data, getComparator(order, orderBy))
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
.map((row, index) => (
<TableRow
className={(classes.tableAltenativeColor, classes.tableRow)}
key={index}
>
<TableCell style={{verticalAlign: 'top'}}>
<Button
onClick={() => {setRecord(JSON.stringify(row))}}
href={`${config.home}edit`}
>
<EditNoteOutlined
color={"primary"}
/>
</Button>
<EditRecord record={record}/>
</TableCell>
))}
</TableBody>
)