I'm using a trash can icon in a react-table row, and I want to delete the row when the icon is clicked (my knowledge of HTML/JS is very basic). But when I put an onClick handler either in or around the icon, it fires as the page is rendered, and not at all when the icon is clicked.
Here is my current row definition. I've tried div and span, and I tried using a button, but the icon didn't display correctly:
{
width: 50,
filterable: false,
Cell: row => (
<div align="center" onClick={alert("clicked")}>
<i className="fa fa-trash-o"></i>
</div>
)
}
Can someone please tell me what I'm doing wrong?
buttoninstead of adiv