Twitter | Search | |
Erik Rasmussen πŸ‘¨πŸ»β€πŸ’»πŸ‡ΊπŸ‡ΈπŸ‡ͺπŸ‡Έ Oct 25
React Hooks are made possible by what a whacky and hackable language Javascript is. I'm a bit nervous by how much it reminds me of the old prototype hacking tricks that JS libs did. Those are my initial thoughts.
Reply Retweet Like
Sophie Alpert Oct 25
Replying to @erikras @dan_abramov
I don’t think we’re actually relying on any JS β€œquirks” here. Hooks could work the same in almost any language. What aspect did you have in mind?
Reply Retweet Like
Erik Rasmussen πŸ‘¨πŸ»β€πŸ’»πŸ‡ΊπŸ‡ΈπŸ‡ͺπŸ‡Έ Oct 25
It feels a bit magical. I could be totally off base, but, judging solely from what I saw in Dan and Ryan's talks, React must be keeping some sort of a "call" stack to know what component is currently being rendered (having its render function called) on every call to useHook().
Reply Retweet Like
Erik Rasmussen πŸ‘¨πŸ»β€πŸ’»πŸ‡ΊπŸ‡ΈπŸ‡ͺπŸ‡Έ Oct 25
This is precisely how I imagined it. Kudos for mock coding it. ❀️
Reply Retweet Like
JaaΝ‘r αΈ€ewer Oct 28
Well, it is mutating and side-effecty. It's all fine if everyone knows what to expect.
Reply Retweet Like
BOOlean πŸ‘»πŸΆπŸ³οΈβ€πŸŒˆ Oct 28
Replying to @jaaaarwr @erikras and 2 others
React has always been mutating and side-effecty. The entire point of React is doing those things so you don't have to
Reply Retweet Like
JaaΝ‘r αΈ€ewer Oct 28
Fair enough. As I said, it's just a matter of communication. I'm not against it.
Reply Retweet Like
Ash Connell πŸ”₯ Oct 28
This is pretty much how mobx tracks which observables belong where. It's far from a hack too, it's a benefit of having a single thread
Reply Retweet Like