The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases. It does not, however, prevent any default behaviors from occurring; for instance, clicks on links are still processed. If you want to stop those behaviors, see the preventDefault() method Please check out the tutorial on ES6 features to learn more about arrow function. Stopping the Event Propagation . You can also stop event propagation in the middle if you want to prevent any ancestor element's event handlers from being notified about the event. For example, suppose you have nested elements and each element has onclick event handler that displays an alert dialog box. Normally.
To stop an event from further propagation in the capturing and bubbling phases, you call the Event.stopPropation() method in the event handler. Event .stopPropagation (); Note that the event.stopPropagation() method doesn't stop any default behaviors of the element e.g., link click, checkbox checked I want to stop the click event from bubling up. Therefore I added e.stopPropagation() in my code. I always get a mistake in the console, that says: Uncaught TypeError: e.stopPropagation is not a function What is the right way to set the stopPropagation in reactjs