Comments (2)
在React中,"onClick"、"onDoubleClick" 只要是以 on 开头的属性,就是在向react描述期望达成的行为。但react本身不会在底层DOM节点上添加真正的事件处理器。React实际做的是在根元素上添加单个事件处理器,由于事件冒泡机制,这个处理器会监听所有事件。当浏览器触发我们想要的事件时,react会代表相应组件调用处理器,这个技巧称作事件代理,可以优化内存和速度。
from js-self-answer.
vue 在 v-for 时给每项元素绑定事件需要用事件代理吗?为什么?
from js-self-answer.
Related Issues (2)
- 声明对象时,要使用const还是let? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from js-self-answer.