hope you all are doing well, I am new to ReactJS and JSX syntax below in the problem I am rendering a table element based on different roles from the same Generic Table component now I have to set onClick attribute's navigation on basis of role and I cannot make a function outside of the scope because I am using the rowIndex to fetch the resignation_Id so can anybody please explain me how to resolve this problem?
<TableCell>
<Button
onClick={
// if(`${props.heading}` == "CLEARANCES"){
// markCleared(`${row.resignationId}`)
// } else if{
// }
`${props.heading}` == "CLEARANCES"
? () => markCleared(`${row.resignationId}`)
: () =>
navigate(`/resignations/${props.role}/action/${row.resignationId}`)
}
variant="outlined"
size="small"
color="success"
>
{props.buttonTitle}
</Button>
</TableCell>
</TableRow>
))}
</TableBody>