React boys and girls, here
<List component="nav" aria-label="main mailbox folders">
{
this.state.apiRes.map((todo: any, i: any) =>
<ListItem button key={i}>
<ListItemIcon>
<InboxIcon />
</ListItemIcon>
<ListItemText primary={todo.item} />
<ListItemSecondaryAction>
<IconButton edge="end" aria-label="delete" onClick={this.handleDelete}>
<DeleteIcon />
</IconButton>
</ListItemSecondaryAction>
</ListItem>
)
}
</List>
when the onClick= is triggered, I want to pass the todo.item to it, so as to access in
handleDelete(value: any) {
console.log(value);
}
How is it done in react?