Coder Social home page Coder Social logo

Comments (2)

Southhill avatar Southhill commented on June 30, 2024

在React中,"onClick"、"onDoubleClick" 只要是以 on 开头的属性,就是在向react描述期望达成的行为。但react本身不会在底层DOM节点上添加真正的事件处理器。React实际做的是在根元素上添加单个事件处理器,由于事件冒泡机制,这个处理器会监听所有事件。当浏览器触发我们想要的事件时,react会代表相应组件调用处理器,这个技巧称作事件代理,可以优化内存和速度。

from js-self-answer.

Southhill avatar Southhill commented on June 30, 2024

vue 在 v-for 时给每项元素绑定事件需要用事件代理吗?为什么?

from js-self-answer.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.