onClick
aminmc opened this issue · 2 comments
aminmc commented
Hello I’m looking to be able to click on a tag and filter my results. I noticed you mentioned that I could use a tagComponent but how do I distinguish between an onClick event that isn’t a delete? The example seems to take onDelete function. Is there an internal event I could register that defines a click rather than a delete?
Thanks.
i-like-robots commented
There is no restriction on the markup used by the provided TagComponent
, if you wish to render multiple buttons with different onClick
event handlers that's entirely possible:
const onClickFilter = () => { ... }
function TagComponent({ tag, onDelete }) {
return (
<div>
<button type='button' onClick={onClickFilter}>
Filter
</button>
<button type='button' onClick={onDelete}>
Delete
</button>
{tag.name}
</div>
)
}
aminmc commented
Super...thanks @i-like-robots appreciate your help. I'll investigate this approach.