Giter VIP home page Giter VIP logo

Comments (3)

tomconnors avatar tomconnors commented on August 29, 2024

As a potential user of this lib, I like the purely syntax-based option the most. hx.react/fnc* could walk the body and warn if symbols beginning with use or <- are used in disallowed contexts. Might be hard to enumerate the allowed vs disallowed contexts though.

Off topic and feel free to disregard entirely, but I don't find that <- is an improvement over use. "<-" doesn't obviously translate to "use" - without looking at docs I would think it means something closer to "take", and use has the advantage that it's what react already uses.

from hx.

lilactown avatar lilactown commented on August 29, 2024

That’s good feedback. I liked the look of <- at the beginning because it made the syntax stand out, and also was similar to a syntax someone proposed somewhere (can’t find it rn) that was like:

function MyComponent(props) {
  let counter << state(0);

  ...
}

I do think that there could be some sort of syntax that is more evocative of what Hooks do - hooking into the component’s render cycle and doing some sort of side effect - but the drawbacks of using <- in the function name is starting to grate. For instance, they show up as garbage in React DevTools.

I guess that begs the question: what should we use as the standard? Should we do camel case useXyzAbc? Or kebab-case use-xyz-abc? I’m kind of leaning towards keeping the React idiom in general. Hmm.

from hx.

DjebbZ avatar DjebbZ commented on August 29, 2024

from hx.

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.