React 阻止事件冒泡

简单来讲php

 e.stopPropagation() 能够阻止合成事件之间的冒泡  不能够阻止合成事件到原生事件的冒泡react

 

由于React委托的document 和原生document不是同一个事物jquery

e.stopPropagation()阻止的只是到react对应document事件

而当事件触发时,会向 react和原生document两个方向传递io

 

若是要阻止这两种冒泡,得写上下面两句,就真正阻止了冒泡event

e.stopPropagation();
e.nativeEvent.stopImmediatePropagation();
 
stopImmediatePropagation()的做用 详见   http://www.runoob.com/try/try.php?filename=tryjquery_event_stoppropagation
 
至于为何
e.nativeEvent.stopPropagation(); 不可行
而e.nativeEvent.stopImmediatePropagation();可行  还不太清楚