Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React:React合成事件和原生事件 #48

Open
HCLacids opened this issue Feb 28, 2022 · 1 comment
Open

React:React合成事件和原生事件 #48

HCLacids opened this issue Feb 28, 2022 · 1 comment
Labels

Comments

@HCLacids
Copy link
Owner

HCLacids commented Feb 28, 2022

参考链接

V17 之前,合成事件和原生事件的执行顺序与冒泡/捕获模式无关,原生事件恒早于合成事件

V17 后,合成事件和原生事件的执行顺序与冒泡/捕获模式相关,冒泡模式,原生事件早于合成事件,捕获模式,合成事件早于原生事件。

@HCLacids HCLacids added the React label Feb 28, 2022
@HCLacids
Copy link
Owner Author

参考链接
事件处理函数不是绑定到组件的元素上的,而是绑定到root上,这和fiber树的结构特点有关,即事件处理函数只能作为fiber的prop。
绑定到root上的事件监听不是我们在组件里写的事件处理函数,而是一个持有事件优先级,并能传递事件执行阶段标志的监听器。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant