News for hackers. Stuff that matters.
Re:React v17.0 Release Candidate: No New Features by hazz99 on Tuesday August 11, 2020 @04:54AM (#24118490)
This is fair, but I really enjoy using hooks. I personally feel my code is faster to write and easier to understand.

It makes it much easier to have composable functions/state, which I love.

Re:React v17.0 Release Candidate: No New Features by have_faith on Tuesday August 11, 2020 @06:01AM (#24118784)
It's certainly faster to write once you get the hang of it but I don't think it's easier to understand. People seem to converge on multiple useEffect's with anonymous functions with non obvious scope for variables, empty arrays to designate behaviour that isn't obvious, lots of subtle async gotchas, stale state variables, etc.

They certainly work when you memorise the rules and syntax, but it feels very contrived even when it all makes sense.

Re:React v17.0 Release Candidate: No New Features by steve_adams_86 on Saturday August 15, 2020 @10:51AM (#24169286)
> empty arrays to designate behaviour that isn't obvious

This drives me a little crazy too. That behaviour can be easily documented by wrapping it in a function with a name that makes sense, but people litter their React code with non-obvious hooks everywhere. You can reduce a lot of boilerplate (why are you writing empty arrays everywhere!?) and improve readability substantially by wrapping the hooks in more composed and idiomatic functions.

I think that was along the lines of what was intended for hooks, but I don't see it often.