Hacker News new | ask | show | jobs
by Aeolun 1778 days ago
React does not seem like a good fit for doing any of these things. Aside from keyboard navigation, which works just fine as far as I’ve seen.

I dunno, every time I see someone hating React they’ve been kind of stuck in doing things the jQuery way, and their components become this horrible frankenstein of modifying HTML both through React and directly.

2 comments

Keyboard navigations as in up/left/right/down jumps around somewhat haphazardly placed items. Not tab/shift-tab accessibility.

And you are right that React is not a good fit for these things. That's why I say it's very limiting.

Also, for what it's worth, you might be mistaking "the jquery way" with "the vanilla way." As in:

- working with HTMLElements

- vs working with a superset (tsx) of a superset (ts) of javascript meant to look like html (sometimes), that creates js components that then create html that is then diffed with last html and finally applied to the appropriate innerHTML (and don't forget about all the hooks!).

Yeah, React is a pain for when you need to interact with the DOM elements themselves. If you want to add some logic based on where the element happens to be placed, instead of where you have told React to place your element, you're in for a headache. Now the DOM is one source of state (positioning) and your store (Redux or otherwise) is no longer the single source of truth.
IMO, there's no way it lasts purely because of this.

We already have the DOM, and there's literally nothing that React can do that requires its complexity EXCEPT server side rendering. Which most people never use.

> their components become this horrible frankenstein of modifying HTML both through React and directly.

I need to know what the problem is with modifying HTML inside a browser that knows and expects the HTML to be modified, even providing DOM APIs for this exact reason. What is the benefit of modifying a not the DOM besides the dubious claim of performace++?

I use react everyday now BTW. I needed to do something trivial like use something similar to setproperty to update CSS variable with JS returned values. This was part of a component that gets 3 colors and returns an array of RGB values which I need to change the background into a gradient. The one piece of advice I got from the internet is...

styled components.

FfS.

React is breaking every best practice from ~20 years ago of keeping concerns seperate. Sure Jqeury wasnt perfect but I could get a junior dev fresh out of school up an running in two weeks flat. There was no need to bend the time-space continuum with the black whole density of node_modules for every_single_thing.

Nothing at all. I've been using a custom made framework for 3 years that does everything React does and more. I could write the whole thing in a weekend. It's not hard, you just cache some functions that create HTML Elements, keep track of what state variables are used inside those functions, and rerender whenever those variables change.

React was a dumb idea from the very beginning, and anyone who knew vanilla js well could tell you that.

> I need to know what the problem is with modifying HTML inside a browser that knows and expects the HTML to be modified

Nothing. As long as you’re not using React and value your sanity.