I have this scenario, where when parent element is clicked, it flips to show a child element with different colours. Unfortunately, when the user clicks on one of the colours, t
You can use stopPropagation
stopPropagation
- Prevents further propagation of the current event in the bubbling phase
var App = React.createClass({
handleParentClick: function (e) {
console.log('parent');
},
handleChildClick: function (e) {
e.stopPropagation();
console.log('child');
},
render: function() {
return
Click
;
}
});
ReactDOM.render( , document.getElementById('root'));