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

Here's things that are super simple to do with Javascript but extraordinarily difficult in react:

* a function your code can access

* data your code can access

* a dom node you can access

The very core parts of basic programming have been slaughtered and perverted in some kind of repulsive overengineering porno show.

I've worked 3 months on something that should have literally taken 2 days. React is giant sack of bullshit that's made it take months.

Instead of managing say a global object there's this sheer utter insanity of redux store. Something that I could explain in 10 words now takes 9,525: https://www.valentinog.com/blog/redux/

The pythonic notion of "we're all adults here" has been replaced with "we're all completely utterly incompetent children here that need safety locks on everything". I no longer know what works.

I'm actually astounded, I'm not joking in the slightest, in any way whatsoever that

   var a = 10 + 5;
still works and I'm not forced to do something like:

    let a = [...new Array(10).fill(0), ...new Array(5).fill(0)].length;
as a workaround.

I am quite literally shocked by this. Just thinking that this is still possible made me actually shout in happiness at my desk. I really just did that.

I wish I was being sarcastic. I'm not. React breaks programming that much. At that fundamental of a level. It's that profoundly bad.

Coding in react is like if you wanted to get out of bed and take a shower but then find out your town has been carpet bombed and you're sitting underneath piles of collapsed concrete. So first you need to survive the day, get rescued, clear out the rubble, then rebuild everything, then you can go take the shower. Shit's so much easier this way!!!

No.

No it fucking is not.

Just no.

This vile framework is the most vulgar code in an already repugnant front-end javascript ecosystem. It's utterly shameful.



Amen! Have been waiting for a react replacement for ages. Hate using it for all these same reasons. Use preact, but mostly same issues.

The fact that they change the seemingly every few months, and have the entire framework scattered around 3-4 different libraries that are always changing is annoying enough.

Oh you want to set the class of the html element? We're gonna rename that to className cause it's easier to read and and we can.

Functional components and hooks become a ridiculous mess too, in any more than basic scenario.


Here's another example. Say in javascript I want to navigate to a page 'login', here's a way to do it.

    window.location = 'login';
And there I go!

In react, well it really depends on what version. If I'm doing pre-hook (pre 16.18 or so) classes, first I need to make sure my constructor brings in props that I call a super on.

Huh?

No no stay with me. Then I have a this.props.history object and I push a new entry on to the stack like so

this.props.history.push('login');

Remember to make sure you use the fat-arrow to pass the this reference downward and that you export your class using withRouter. Effectively here's the replacement code:

    import React from 'react';
    import {withRouter} from 'react-router';
    Class A extends React.Component {
      constructor(props) {
       super(props);  
      }  

      fn() {
       this.props.history.push('login');
      }
    }

    export default withRouter(A);
And even then you may still have to "debug" this because it may "break" for inexplicable reasons. Because "In order to make use of history in the App component use it with withRouter. You need to make use of withRouter only when your component is not receiving the Router props,

This may happen in cases when your component is a nested child of a component rendered by the Router or you haven't passed the Router props to it or when the component is not linked to the Router at all and is rendered as a separate component from the Routes."

Again, we are replacing:

    window.location = 'login';
That is our only goal here

How is this easier then the first one? It isn't.

What problem has been solved? None.

Does it take less time? No.

Is this less typing? Less code? No.

Less complexity? No.

Are difficult things less difficult? No.

Fragile things more robust? No.

No none of this. It runs away from more reusable, self-contained, portable code as fast as possible. It gets in a rocket car and fires up the engines to go Mach 1 in the wrong direction. It's a giant tangled spaghetti dish of the worst anti-patterns in software engineering as a requirement for it to work.


For future readers, a flagged dead sibling comment said this

> Poor child. Wait until you have to build a sufficiently complex web app. Global variables are never the answer

"never the answer" is a Fundamentalist Orthodoxy.

Look at those words, "fundamentalist" and "orthodoxy".

When they are the answer and are needed then instead of a basic global thing some bizarre fundamentalist mind palaces get built. There's say "a singleton object that expose shared properties through a getter/setter pattern" or some other word salad to avoid using the word "global" and avoid making the code look like a global.

So weird rules get piled on, maybe some ornate calling convention.

These people dress up a global and disguise it in a sufficiently large enough costume so their fundamentalism doesn't get offended.

It's simply blind dogmatism and utterly indistinguishable from any other cult-driven purity test.

The ceremony is a necessary delusion so they can maintain some imaginary tribal membership to some fiction of "senior developer" they have constructed out of bad advice and empty platitudes by other misdirected self-assessed experts.

It's like the anti-climate-change or anti-vaccine people who think they are smarter than everyone; ignorance breeds a confidence that only progresses the pursuit of greater ignorance. Like astrology, these imagined worlds are far richer and more complicated because they have to construct something that follows arbitrary rules and disagrees at a fundamental level with basic realities to prop up mythical narratives holding their tribes together.

What a way to build things.




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

Search: