3 ms·
To play devil's advocate a bit: I don't think you were wrong the first time. I mean, as long as hooks are strictly an addition, it's easy to argue greater simp
by westoncb 7y ago
To play devil's advocate a bit: I don't think you were wrong the first time.
I mean, as long as hooks are strictly an addition, it's easy to argue greater simplicity without. That's kind of trivial though, so I would ask how thematically related they are.
If they both clearly stem from the same set of underlying principles and motivations, I think it's fair to say the addition is not substantially a complication. But is that the case for hooks? (I don't know—haven't looked into them yet :)
But maybe the confusion is whether the additional complexity we're talking about is in React itself, or in the systems being built with react. In that case, old React may be simpler, but the code it produced was more complicated; or React with hooks may be more complicated, but the code you write with it is now simpler.
- Izkata 7y agoI'd argue it's more complicated by way of how much confusion I see with newbies. The old class-based lifecycle+methods was pretty straightforward - it only looked complicated at a glance. Hooks on the other hand do enough magic in the background that each one seems to come with its own set of misconceptions that have to be corrected.
- BigJono 7y agoThe ironic thing is that hooks are marketed by the react docs as being the solution to avoiding the "difficulty" newbs have with classes. Which I (as a proponent of hooks) think is fucking batshit insane, and clearly shows the disconnect of the React devs from their user base. Teaching beginners how to code, and how to use React, is a large part of my job. And I can say with absolute conviction that the React team is wrong about this. The 'hooks' whiteboarding session has gotten me far more blank stares than the 'classes and lifecycles' one ever has. Having said that, as a senior dev with a ton of React projects under my belt, I definitely prefer the hooks paradigm after using it in a few projects. It makes for cleaner code, and certain concepts are much easier to reason about with the hooks model. Just don't ever expect it to give you a cleaner on-boarding process. That's not at all where the benefit lies, despite what the docs tell you.
- Izkata 7y agoShould probably dump it here myself: My experience is mainly with co-workers (years of experience) and new hires (just out of college/bootcamp) who can code, but haven't yet used React.
- BigJono 7y agoYeah my experience is pretty much all with beginners (usually fresh out of a bootcamp or college, or switching from tangentially related industries like CSE). I'd be interested to see how someone who was a beginner but learnt via FP would grasp each approach. I've never met one in the wild though, it's not like bootcamps start with Haskell.
- erikpukinskis 7y agoAre they a strict addition? I never learned class-based components. I literally never think about “mounting”. I also never think about “updates”. I do think about rendering as something that happens continuously all the time outside my control.