I have tried doing e.stopPropagation();
and e.nativeEvent.stopImmediatePropagation();
This is what my code looks like for the child component:
class S extends React.Component {
handleClick(e) {
e.preventDefault();
e.stopPropagation();
e.nativeEvent.stopImmediatePropagation();
}
render() {
return (
<div class='box' onClick={this.handleClick.bind(this)}>
</div>
)
}
}
But in the parent component, the event for click still gets triggered
Any ideas??
Thanks