Dan Abramov, a React core team member, writes long explainers on React, hooks, effects, and more recently the AT Protocol.
Commenters praise his longreads, especially the social filesystem essay, and link his algebraic effects post when discussing function coloring and language design.
I highly recommend this talk (first half) for a great introduction of how React Hooks work internally, Ryan remakes the basics of hooks from scratch in 30 min:
https://www.youtube.com/watch?v=1jWS7cCuUXw
I agree on 2 of the points of Jared Palmer but disagree on one:
- [agreed] The new "Concurrent Mode" will take things to a new order of complexity. I am actually very afraid of this, it seems like one of the things that might actually kill React, and I love working with React. I like it so much that I've invested into creating few React libraries to make my life easier.
- [agreed] React Hooks are difficult to get started with and to really understand them. IMHO this is mainly due to "React lifecycle", which is just a difficult concept (even with classes!). Life is not easy, and there are some times that there's complexity and you need to learn new complex concepts. No issue here IMHO.
- [disagree] React Hooks is currently magic. While it's a complex piece of software with many small details, once you understand fairly well the lifecycle (and React docs are great at this, and Dan Abramov's https://overreacted.io/ digs a lot deeper for the curious) all bugs are very clear.
I am currently mentoring someone in React who already knew HTML+CSS+JS, my recommendations are: get used to the syntax by practicing, learn the 3-4 typical libraries, and learn very well the lifecycle including how useState's setState and useEffect's dependencies work. That's most of day-to-day React…
Hooks are great for simple use cases like `useState`, `useContext`, some uses of `useRef`, etc. and can make the code easier to read and reason about (while conveniently working very well with TypeScript).
The rules do start to get really tricky though with complex use cases of `useEffect` and multiple levels of nested hooks, and implementation problems are often not easy to spot or debug.
Dan Abramov has written a lot about the philosophy of hooks[0] at his site overreacted[1], I'd love to see a 'retrospective' write-up from him or another React team member about what they think the success and failures of hooks have been so far and if there are any changes planned for the future!
[0]: https://overreacted.io/why-isnt-x-a-hook/, https://overreacted.io/algebraic-effects-for-the-rest-of-us/, https://overreacted.io/a-complete-guide-to-useeffect/
[1]: https://overreacted.io/
It would be in your best interest to at least _learn_ hooks, since they are gaining popularity and are the presumed future of React [0]:
> In the longer term, we expect Hooks to be the primary way people write React components.
I also recommend learning the differences between function components (the prerequisite of hooks) and class-based components. This way you can gain understanding into why one would want to use one over the other which will ultimately serve you better than simply learning something just for the sake of learning it. "How Are Function Components Different from Classes?" [1] by Dan Abramov is a great start.
[0] https://reactjs.org/docs/hooks-faq.html#should-i-use-hooks-classes-or-a-mix-of-both
[1] https://overreacted.io/how-are-function-components-different-from-classes/
Edit: formatting (every time...)
Like I said above and in the post: it was an attempt to generalize the data fetching patterns developed inside of Meta and make them available to all React devs.
If you watch the various talks and articles done by the React team for the last 8 years, the general themes are around trying to improve page loading and data fetching experience.
Former React team member Dan Abramov did a whole series of posts earlier this year with differently-focused explanations of how to grok RSCs: "customizable Backend for Frontend", "avoiding unnecessary roundtrips", etc:
- https://overreacted.io
Conceptually, the one-liner Dan came up with that I liked is "extending React's component model to the server". It's still parent components passing props to child components, "just" spread across multiple computers.
This is a short read - https://overreacted.io/goodbye-clean-code/
But it captures it perfectly, a large number of engineers go from jr to intermediate with their new found tricks. Except they cling to these tricks like it’s law, they have upskilled in one direction while sacrificing the open minded pragmatism for dogmatism. They’ll argue with you about these things, it’s in a book how can you not adhere to it!!?
If you can onboard these lessons and still recognise the spots where it’s begging for some best practice but you should break the rule this time, then congrats you’re ahead of the curve, it takes most engineers a frustratingly long time to get pragmatic. If I had a penny for every awful DRY abstraction that became impossible to reason about, I’d have retired.
Thanks for your work! Reading the article, seems like the main debate is on whether this should be included in pip. Fwiw, as a user experience, including it seems best. I think the experience npm (tries to) provide is a fine goal. However, whether it's a priority for pip and burdening maintainers is another matter.
In any case, I'm more concerned with not repeating npm audit's mistakes. Abramov's blog post linked in the article [1] popped to my mind right away.
Can you say any more about how pip-audit won't "cry wolf"? Especially since Python doesn't have great packaging standardization around tools, dev-dependencies, build dependencies, pip-tools vs pipenv vs poetry, etc.
[1] https://overreacted.io/npm-audit-broken-by-design/