[英]Is there is any difference between Javascript events and React Events?
In javascript, we use onclick event and in React we use the onClick event.在 JavaScript 中,我们使用 onclick 事件,而在 React 中,我们使用 onClick 事件。 My question is event provides my React is the same as a javascript event or React handle event differently.
我的问题是事件提供我的 React 与 javascript 事件相同或 React 处理事件不同。
React uses a synthetic event system, which is a cross-browser wrapper around the browser's native event. React 使用合成事件系统,它是围绕浏览器原生事件的跨浏览器包装器。 In most cases, a developer may not notice the differences, but they do exist:
在大多数情况下,开发人员可能不会注意到这些差异,但它们确实存在:
onclick
and onClick
events are the same. onclick
和onClick
事件是相同的。
The only difference is the capital of the "C".唯一的区别是大写的“C”。
Warning警告
onclick
event is deprecated in javascript. javascript 中不推荐使用
onclick
事件。 Now, we use addEventListener
and then onclick
event inside.现在,我们在里面使用
addEventListener
和onclick
事件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.