Giter VIP home page Giter VIP logo

Comments (1)

fluffynukeit avatar fluffynukeit commented on July 24, 2024

With virtual-dom, you can make your own custom vnode properties and name them whatever you want as long as their value is a "hook". The hook defines what happens when such a custom property is added or removed. So you're right, the property name "click" doesn't affect anything. I could have called it "banzai" or "orange" or whatever. But I need to call it something so that virtual-dom can compare it between renders to the previous value and do an update if needed. I happened to call it click because it is a hook that sets up a click handler.

The comment about needing to be hooks is implying that this is a dumb way to do it. You don't need hooks to set up click handlers because you can just use the "onclick" property as long as the value you provide to onclick has the correct form. I was experimenting with vdom and trying things out, which is why the hook method is still in there with a comment suggesting a better way to do it.

You might also want to check out puzzler2, which uses the onclick, etc, directly. That implementation has its own set of problems, but I think is overall cleaner in terms of the view.

from purescript-puzzler.

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.