Coder Social home page Coder Social logo

Comments (4)

FrancescoCioria avatar FrancescoCioria commented on June 22, 2024

Your solution looks definitely easy to use but not very easy to read and may be hard to debug (is it? I wouldn't know how to improve it actually...). Other possible solutions could be:

  • importing and using a utility function as we do for valueLink (it may be more readable, but it would work the same way I think)
onClick={revengeBind(myFn, myArg1, myArg2)}
  • passing prop with a special suffix and then removing it to let components use props as usual (black magic?)
bindOnClick={[myFn, arg1, arg2]}

from revenge.

giogonzo avatar giogonzo commented on June 22, 2024

onClick={revengeBind(myFn, myArg1, myArg2)}

👍 for something like this. Costs: adds an import on "user" component. Pros: makes it explicit we intend to pass a PureFunction prop

passing prop with a special suffix and then removing it to let components use props as usual

Seems too much, especially considering the above "tagging" mechanism we should be safe enough

from revenge.

giogonzo avatar giogonzo commented on June 22, 2024

Added pureFunctionProp, see here for examples: https://github.com/buildo/labonline/commit/9a2257002b4ce4ca0966ba2245d959961d47113a

from revenge.

giogonzo avatar giogonzo commented on June 22, 2024

naming is misleading probably, but at least it is clear that it builds on top of a pure render implementation. Merge as it is for now

from revenge.

Related Issues (20)

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.