SPBesui
I don’t know how many parents feel this way when bringing their first-born home from the hospital, but my spouse and I felt like the doctors were crazy to trust us, a couple of twenty-somethings, to take home a child and actually keep it alive and do all the things adults do for children.
Maybe that was wise of us to realize the level of our inexperience, but I think that feeling of inadequacy applies to most humans in many situations. We look for leaders to follow, intellectuals to learn from, heroes to worship, and monarchs to rule us. Otherwise, who is the adult in the room?
I’m guessing you’re referring to the fact that you can’t access component state like you can with class components. If so, that’s not required to do a unit test. That’s a sign that implementation details are leaking into your tests.
Also custom hooks are vastly more readable IMHO than HOCs.
Also, I agree the “math is tiny“ but the talent, work ethic, luck, etc. required to separate oneself from the good to be great is *enormous*.
Class components only made you feel like they were easier to understand because the method names indicated an intuitive lifecycle. But the reality under the hood was almost certainly different than your mental model because the method/event handler names were actually deceptive. Hooks are much closer to the metal, so to speak.
> A backend developer could open a .tsx file and understand what is going on, and make simple fixes.
They might assume they knew what was going on and how their "simple fixes" would affect execution, but that would probably be naïve. But that goes for anyone jumping into any codebase for a platform/library that they're not familiar with.
> Hooks makes some things easier but the cost in terms of loss-of-intuitiveness is huge.
This is fair, although I feel like the learning curve for React is only steep at first, then plateaus for the vast majority of application developers. It only gets really complicated (as anything does) when you start to get into advanced performance tuning or you're writing a library with very specific requirements.
> The other mistake Facebook is making is assuming that performance is the most important attribute of a UI framework.
This is simply not true. The React team has indicated many times over the years that basic, hello-world level, idiomatic React code is fast enough for the vast majority of applications ("don't worry too much about the number of re-renders," etc.). They're very anti-premature optimization as a group.
Also, Hooks weren't introduced to improve performance anyway (at least that wasn't the primary motivation).
> handling deeply nested objects in the state without making entire copies of the data
It's not from the React team, nor is it specific to React, but have you tried immer? https://immerjs.github.io/immer/
(I do apologize if I came across poorly—I couldn’t think of another way to ask the question.)
That was kind of their point: No one is, so why bother with a lot of effort?
> The apps with bundle sizes that people complain about are almost exclusively from third parties.
Right, like Box. Not the internal apps they were referring to.
> I've worked on some big internal apps, and almost none of them have payloads big enough to notice.
That echoes my own experience.
> If it ain't broken don't fix it.
I think you’re agreeing with the person you responded to. It was just that Box wasn’t the kind of app they were talking about. All I was saying was that your response, while interesting, was not 100% relevant. It was still interesting, though!
If you’re talking about the one with the Punisher lock screen, I’m pretty sure his wife was contacting him telling him she’d been shot and was dying. AFAIK he wasn’t just “checking his phone” out of boredom.
This sums up pretty much every political debate ever.