Why We Should Ditch React [video]
youtube.com
youtube.com
TLDW: “the whole point behind this video, guys, is maybe we should ditch React because all of these changes are because of short-sighted architecture, and maybe we all shouldn’t just be these herd animals that are constantly taking and following the herd from one section of the field to the other you know we keep going around in circles and getting nowhere.”
But then also: Use Polymer.
Definitely garbage YouTube click bait here. Don’t bother.
> React makes a lot of changes [...] the constant iteration in response to changing expectations for web
maybe it's ironic we're having that discussion on HN, and i'm struggling to remember sites that have gotten better lately, not worse. then again, that's probably because of the bias to remember negative experiences
React peaked at v16.
Couldn’t disagree with you more here. Smart devs use smart abstractions. Hooks is a smart abstraction because 1) classes and inheritance don’t belong in JS, 2) they allow for more code reuse, 3) they allow you to write simpler, more declarative code.
You gonna back this claim up? Because it doesn't stand on its own. Inheritance certainly doesn't gel with _React_ (use composition), but to say it doesn't belong in JS is rather naive.
> 2) they allow for more code reuse
You can already get just as much reuse out of React's context API
> 3) they allow you to write simpler, more declarative code.
This is rather subjective, but I'd argue it's not simpler, because it "hides" the state with internal magic, and it's not even more declarative because using a context (or composition) based approach would be just as declarative.
I'd actually argue it's far more complex, because each invocation of `useEffect` doesn't even have the same result! There's some behind-the-scenes magic going on that makes it harder to reason about and find bugs.
The nice thing about having classes is that it's very easy to understand what code runs when a component is initialized (constructor and componentDidMount) versus what code is run on each render cycle (the render method). Hooks just removes that whole distinction and throws everything into one place. Devs who are new to React will definitely struggle with understanding what is going on behind the scenes.
The point of the video is not so clear, maybe it's why reinventing the wheel again and again and not coming up with a good wheel once again.
First what I like of React vs (example) jQuery: despite the complexity a React (or Angular or whatever) application is infinitely more maintainable than the corresponding jQuery one. I converted one to React when I didn't dare anymore to fix bugs in a jQuery monster I created.
However, wrestling with dispatch, props, Object.assign, actions etc can't be the right way to do it. After all these web applications are the same thing we were doing in the 90s with VisualBasic or similar systems. Replace disk access or local Access dbs with JSON calls over HTTP, not a big difference and yet, coding a React app is a miserable experience. I think frontend developers should be paid twice as much as backend ones: they do a much more difficult job. For sure I don't want to do frontend development: it's not an efficient way to make money.
Some context: I'm mostly a backend developer now and I'm spending a few days working on a React frontend every two or three months. So I'm a little too rusty every time I start working with React. That doesn't help but I can't help feeling that code as complex as this smells of wrong architectural decisions. A collegue told me that Vue is much more pleasant to work with. I could give it a try if I'll ever have a personal project needing a complicated frontend. Server generated HTML is fine for everything else.
Not worth the watch.