I have a table which have a button and button have onClick() function, I am passing a method to onclick, But the ids are in an array.
i can console.log like props.requests[0].objectId.
const actionButton = (published) => {
if (props.userType === 'crick') {
if (props.data.verified) {
return published === true ? <Label>Published</Label> : <Button basic onClick={() => scoreAction(// Have to pass ids here)} >Publish</Button>;
}
}
}
And the table is below from the above code.
<Table.Body>
{props.loanRequests.map((value, i) =>
(<Table.Row key={i}>
<Table.Cell> {value.cric.name} </Table.Cell>
<Table.Cell> {value.runs} </Table.Cell>
<Table.Cell> {actionButton(value.published)} </Table.Cell>
</Table.Row>))}
</Table.Body>
How can i pass the array of ids to the button's onclick function method.
Note : Semantic UI is in use.