Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I honestly can't wait for the day I wake up and everyone hates React as much as me. I'd also settle for people just forgetting it for something better.


What is it about React that you hate? React has been the near defacto framework for frontend development for a decade now [1]. Like it or not, it's not going away anytime soon.

[1] https://2023.stateofjs.com/en-US/libraries/front-end-framewo...


As a Svelte / vanilla TS dev, I hate React because looking at it makes me feel like I’m drowning in obtuse, leaky abstractions, none of which feel necessary and all of which are required to do _anything_ at all.


Another react hater here. Here are some of my beefs.

  * Components don't have exposed identities, but component state is based on identity.  Secretly they're fibers.
  * Everything is treated as if it's immutable.  Reference equality is used to infer no changes.  Working with array-based state, or almost anything really, is awkward and unnecessarily verbose.  Spread all the things.
  * The rules of hooks.  These are just implementation constraints based on the rest of the design decisions of react.
  * You can't use symbols as keys.  This is small, but particularly irksome for me.
  * The smallest unit of UI change is the component render function.
  * Effect dependencies need to be listed explicitly.
There are more.


> Everything is treated as if it's immutable [...]

Immutability is a great callout; frontend ecosystem is quite divisive on it.

For my flavor, as React exploded, redux and the advanced state management frameworks came and made everything bananas[1]. "It solves real problems for advanced apps"; maybe but I could never shake that these problems are self-inflicted.

There's a mathematical functional purity that's nerd-snipe worthy; but reactivity with mutation observers just seems to model the real world of UIs better.

Anyway, https://mobx.js.org/README.html is the exact opposite take: mutate your state! Subscribe to changes to your heart's content.

The divisiveness is real, it's what makes staying up to date exhausting.

[1] Come on, no one seriously thinks "bind action creators" made intuitive, ergonomic sense.


Mobx is cool. Nice to see some other mutation enjoyers. I also made my own thing[1] called "mutraction" (portmanteau of "mutate" and "tracking") based on this premise that uses jsx and mutation. I mostly made it prove that it could be made and to understand how it would work.

[1] https://github.com/tomtheisen/mutraction


After 10 years I also hate the current incarnation of it.


why do you hate it?

i loved react when it came out, it was magnitude improvement for rapid prototyping. jsx as an idea seems ridiculous, but in practice, might as well make everything js and use the programming language's full power—otherwise you get pseudo-code-in-html. html directives will never be a full programming language, I can't understand why frameworks go down this path, repeatedly!

"fuck it, everything is javascript" is react's great insight, for interactive applications.

The frontend ecosystem overall, i find very exhausting, yes. but that's not on react.

What don't you like about it?


> "fuck it, everything is javascript" is react's great insight, for interactive applications.

I'd argue that jsx was react's great insight. But maybe that's the same thing. Anyway yes. But unfortunately, you can't use react without using the rest of its insights, such as all data must be immutable, and DOM updates are based on reconciliation.

> The frontend ecosystem overall, i find very exhausting, yes. but that's not on react.

That's true. React has more than enough of its own problems though.


jsx is handy but clearly react's 'great insight' if it were to be so reduced, is implicit state management.


If by implicit state management, you're including the abomination that is `useState`, I could not possibly disagree any harder.


I despise JSX as well. Simply because no one is able to handle if else and conditionals in a readable non spaghetti way. Every time I see {condition && <Component />} or {condition ? <ThisComponent /> : <ThatComponent />} I die a little bit inside. In addition to that people to get around these things will do helper functions within the component itself e.g. {renderSomething()} This ends up inside of the component being really unreadable and spaghetti where you have to jump up and down everywhere.

I prefer VueJS or Svelte much more, but unfortunately due to its popularity I am stuck with React.


It's true, components can get unwieldy. That's the feature aspect of components built with a full programming language (js).

In contrast, I can't understand how magic attributes on html nodes is more clear. What's your take on that?

For example in Vue's introduction:

    <div id="app">
      <button @click="count++">
        Count is: {{ count }}
      </button>
    </div>
The completely made up "@click" makes no sense outside of Vue. "count++" is a string that stands for real programming code? So we're making up pseudo code now. And the {{}} interpolation isn't real either, so it's not actually an HTML <template>

Using native HTML nodes, templates, and tags makes it seem standard. This is the worst learning curve: the bait and switch vs being clear—albeit intense—that the component is 100% a JS programming env that yields the UI.

React component is not the UI it's a JS function that yields the UI.


I've been involved in teaching React and FE for more than 10 years (many hundreds of students), and let's be clear here: Students don't understand that JSX is JavaScript either (and let's be clear here as well; it isn't - it's something that can be transpiled to JS). Rather, people believe it's HTML (since it looks like it), and very much confuses all the differences them in-between - in particularly when mixing with JS (eg conditionals).

Not saying that it's bad necessarily, but there are pros and cons to the JSX approach and the template approach (a lá Vue, or actually Mustache that Vue's template syntax partly comes from).

I think what's easiest/best comes down to: 1. Your background (ppl coming from BE tend to prefer to stay in a more full-blown programming language, people with a HTML/CSS background tend to prefer the template approach. 2. How junior you are. Generally people tend to say that React has more of a learning curve then Vue. 3. What your needs are. Full-blown web apps? Simple small enhancements of static websites? How much detailed/special control do you need or your components HTML output, etc.

PS. @click is actually very similar to the native click attribute. Furthermore, React has className as a special attribute that's definitely on a similar level same-but-not-really.


> React has className as a special attribute that's definitely on a similar level same-but-not-really.

The special React-ism that bugs me the most in this area is that React elements map the "change" event to "input". There's no way to handle "change" without getting a ref and wiring it up yourself. As a consequence, most developers don't seem to remember or ever knew what "change" actually is.


Despite Vue having this separate template syntax it felt very easy to learn and natural as opposed to the boilerplate that you get with React. It is not like JSX is understandable out of the gate if you know JS.

I have done html templating syntax in many different languages and frameworks starting with Laravel Blade and it always felt much better than the native syntax of doing that e.g. with PHP.

I don't think it ks a worthwhile feature to have everything strictly JS. Use different tools as they are appropriate, why hinder yourself.

Ultimately there are some very frequent and limited patterns in defining interactive html elements so best to use the syntax that has the highest meaning to noise ratio.

The combination of useState, stateValue, setStateValue are simply unnecessary boilerplate that makes important things like the state variable itself hidden in a sea of noise.

> React component is not the UI it's a JS function that yields the UI

I don't think that is a good philosophy at all. The code should be about clarity not around an odd dogma about having to be a JS function that yields the UI. It in my view is a misplaced enthusiasm for something that really doesn't matter, but will hinder things since you have to constantly work and hack around those self posed arbitrary restrictions.


JS function that yields the UI is not about dogma or JS enthusiasm, to be clear, I would prefer NOT to use JS. And I concede that frontend ecosystem really seems to see "everything in one language" as some kind of benefit and virtue. It's not!

The "everything is JS" and "JS yields the UI" is 100% based on the constraints of the runtime.

Modern UIs need browser APIs, events, DOM management, and stying. We MUST use HTML/CSS/JS. My take is "everything in JS" _in this context_ is more reasonable, more integrated, and ultimately more intuitive, not that it's simple or easy, but that we're stuck with the runtime, we're going to need these all to integrate with one another, let's be clear on in the integration interfaces.


You can do "everything in js" without having functions that return the ui. See svelte or vue or solid or most anything that isn't react.


I'll check those out. Solid keeps coming up, so that's good sign.


Yes. And .map().

And the tag closing semantics are slightly different from HTML. And approximately no one understands how HTML tag closing works anymore because of it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: