Re:Introducing Hooks
by engineeringwoke on Friday October 26, 2018 @05:32AM
(#18307862)
There's already so much magic going on in React's code base. For Fiber, they put the stack in the heap so they could go around the JavaScript call stack and schedule work as they see fit
The real magic is in traversal APIs, like Context
Oh absolutely - by now I have read through the docs, and as I mentioned at [1] as well, I'm even expecting hooks to do away with more magic than it introduces.
That said, my main point was that "it's only magic for end users" is not really a valid excuse :)
[1] https://twitter.com/VincentTunru/status/1055747566393085952
Re:Introducing Hooks
by engineeringwoke on Friday October 26, 2018 @08:53AM
(#18308719)
Agreed, it's not really a valid excuse. Hopefully a scheduler re-write comes along soon to alleviate those concerns. I absolutely share them; I can't read any of that code anymore
I didn't dive into hooks to completely yet to have a proper opinion on it, but the primary disadvantage of "magic" is that the end user can not deduce what's going on just by looking at the code. If magic is therefore "only" restricted to the end user, that's not much of a restriction...