Hacker News new | ask | show | jobs
by moron4hire 250 days ago
The reality is that DOM is pretty high-level already. It's just not that hard to do. The only things that have improved my productivity over the years are:

  A) getting better at handling graph data structure, 
  B) learning how to use Regular Expressions as a code editing tool,
  C) quit chasing every new thing, and
  D) Typescript.
Having spent the last 20+ years building Web apps, I've only just started using React, due to company policy change. And quite frankly, I think it makes it much harder to maintain a large project. My company switched to React to make apps "easier to maintain for everyone" and in the process I've been the only one that has managed to learn React well enough to be productive in it. Most everyone else is really struggling with getting anything beyond the most basic stuff to work.

JSX encourages sloppy HTML. Props are are overly verbose. Hooks are a nightmare. Contexts are gross. Portals are a stupid hack for the very, very stupid reason of making it nearly impossible for parent elements to read anything about their children. The whole "props down, events up" paradigm is woefully naive and half of React exists to get around it because of that.

So yeah, if all you know is react, you've already been on the hard path.

1 comments

So, how do you manage reactivity? Manual DOM patching?
Yeah, it's not that big of a deal.

This whole thing about "absolutely everything must be pure, functional reactive code" is just something that people used as a cudgel to get their fellow developers to adopt React. And React isn't even pure, nor does it really do reactivity right! But it makes for cool demos where you can throw together TODO-APP really quickly and never mind that real world applications have much more, cross-cutting complexity that just can't fit into the reactive paradigm.

Yes, managing program state is hard. Full stop. React doesn't actually solve that problem. In fact, I think it makes it worse, because of how top-down, everything-should-be-props it is. Elements should be able to inspect their children. Elements should be able to move them around however they want. And those elements should be written to just take it.

There are major parts of React's modern design that point to the fact that it was clearly taken over by functional programming weenies (not that I hate functional programming, just the kind of people who insist it's the only way).

We only have to look at Hooks to see why. Hooks must only be called at the top-level of a component. But where do Hooks come from? Regular imports that are then accessible anywhere. It violates the open/closed principle. What should be a protected method of a base Component class, so that only implementing child classes can call it, is instead possible to call from anywhere with no indication it's wrong until runtime. That's just bad design, in OOP or FP. Someone, somewhere at Meta, decided "Object-oriented programming is wrong" and went out of their way to avoid it.