reactjs – RCTDirectEventBlock与RCTBubblingEventBlock

RCTDirectEventBlock与RCTBubblingEventBlock有什么区别? 最佳答案 似乎没有太多官方文档,Facebook已关闭并锁定了要求更好文档的问题.我发现的一个有用的文档表明它纯粹是一种风格差异:

Bubbling events are like DOM events so that a parent component can capture an event fired by its child. Generally these are UI-related, like “the user touched this box”. Direct events are not bubbled and are intended for more abstract events like “this image failed to load”.

通过这个备忘单:https://gist.github.com/chourobin/f83f3b3a6fd2053fad29fff69524f91c

点赞