Hacker News new | ask | show | jobs
by nwienert 1978 days ago
Hooks are not something you instantiate and then just call later, the whole point is that they need to be able to chain/compose with each other, and that has to happen during every render. I'd be really curious to see what your proposal is in concrete code, as on the surface it sounds like it either misses the point of hooks entirely, else it's just a syntactical change that is more a surface-level critique than an actual criticism of the concept itself.

Also your subroutine comment makes little sense. A function that returns different values over time is just that, it need not output anything. In UI programming I guess you'd call everything a subroutine, as state is constantly changing and you're always in need of outputting changing dates, inputs, etc.

The whole point of frontend is you have to accept that fact and find the best paradigm to deal with that constant change of state, and I'll claim hooks do that better than anything before it. If you did have a better solution to hooks, that'd be a big deal, and many people would love to see a good example.