News for hackers. Stuff that matters.
Re:Solid.js feels like what I always wanted React to be by MiddleMan5 on Tuesday March 01, 2022 @12:04AM (#30509864)
Slightly dismissive, but I agree the setInterval function was a little misleadingly contrived.

The transition to functional components was to reduce the coupling between abstract functionality and DOM-related lifecycle events.

React hooks are mostly about expressing where and when you want to memoize a value, with the default being not to.

Once you learn what to look out for, and properly designing and review codebases at scale, these trivial issues don't happen all that often. Additionally, being able to specify memoization parameters explicitly brings extra flexibility and some additional design patterns.

Re:Solid.js feels like what I always wanted React to be by stupidcar on Tuesday March 01, 2022 @04:45AM (#30511936)
What are you talking about? The setInterval example is completely idiomatic React hooks. It is literally given in the React docs:

https://reactjs.org/docs/hooks-faq.html#what-can-i-do-if-my-...

Re:Solid.js feels like what I always wanted React to be by MiddleMan5 on Tuesday March 01, 2022 @12:05PM (#30516680)
Reading it now, the language I used was inappropriate. You're correct, the stated problem is common with registering and triggering self-repeating and timed loops.

That was really my point, don't do that.