React - how to capture only parent's onClick event and not children
Since you are binding the handler to th
you can use the currentTarget property. The target property refers to the element which dispatched the event.
_onHeaderClick(event) {
event.preventDefault();
console.log(event.currentTarget);
}
Check them
_onHeaderClick(event) {
event.preventDefault();
if(event.target === event.currentTarget) {
// handle
}
}
Like this?
event.target.parentNode