ReactJS SyntheticEvent stopPropagation() only works with React events?

ReactJS SyntheticEvent stopPropagation() only works with React events?

I’m trying to use event.stopPropagation() within a ReactJS component to stop a click event from bubbling up and triggering a click event that was attached with JQuery in legacy code, but it seems like React’s stopPropagation() only stops propagation to events also attached in React, and JQuery’s stopPropagation() doesn’t stop propagation to events attached with React.
Is there any way to make stopPropagation() work across these events? I wrote a simple JSFiddle to demonstrate these behaviors:
/** @jsx React.DOM */
var Propagation = React.createClass({
alert: function(){
alert(‘React Alert’);
stopPropagation: function(e){
render: function(){
return (


React.renderComponent(, document.body);

$(document).on(‘click’, ‘.alert’, function(e){
alert(‘Jquery Alert’);

$(document).on(‘click’, ‘.stop-propagation’, function(e){


Solution 1:

React uses event delegation with a single event listener on document for events that bubble, like ‘click’ in this example, which means stopping propagation is not possible; the real event has already propagated by the time you interact with it in React. stopPropagation on React’s synthetic event is possible because React handles propagation of synthetic events internally.

Working JSFiddle with the fixes from below:

React Stop Propagation on jQuery Event

Use Event.stopImmediatePropagation to prevent your other (jQuery in this case) listeners on the root from being called. It is supported in IE9+ and modern browsers.

stopPropagation: function(e){
  • Caveat: Listeners are called in the order in which they are bound. React must be initialized before other code (jQuery here) for this to work.

jQuery Stop Propagation on React Event

Your jQuery code uses event delegation as well, which means calling stopPropagation in the handler is not stopping anything; the event has already propagated to document, and React’s listener will be triggered.

// Listener bound to `document`, event delegation
$(document).on('click', '.stop-propagation', function(e){

To prevent propagation beyond the element, the listener must be bound to the element itself:

// Listener bound to `.stop-propagation`, no delegation
$('.stop-propagation').on('click', function(e){

Edit (2016/01/14): Clarified that delegation is necessarily only used for events that bubble. For more details on event handling, React’s source has descriptive comments:

Solution 2:

I ran into this problem yesterday, so I created a React-friendly solution.

Check out react-native-listener. It’s working very well so far. Feedback appreciated.

Solution 3:

I was able to resolve this by adding the following to my component:

componentDidMount() {
  ReactDOM.findDOMNode(this).addEventListener('click', (event) => {
  }, false);

Solution 4:

It is still one intersting moment:


Use this construction, if your function is wrapped by tag

Solution 5:

Worth noting (from this issue) that if you’re attaching events to document, e.stopPropagation() isn’t going to help. As a workaround, you can use window.addEventListener() instead of document.addEventListener, then event.stopPropagation() will stop event from propagating to the window.

Solution 6:

Update: You can now <Elem onClick={ proxy => proxy.stopPropagation() } />