9
Areg
1y

Why React is soo complicated? Seriously why do we always need to use some stupid shit like this

const [state, setState] = useState();

what the fuck is this? Who designed it that way, why it should always look like shit for no reason? Why its API feels like spaghetti? When i am comparing other front-end frameworks they feel like heaven in their structure.

AND WHAT IS WRONG WITH ME HAVING A QUOTE ON A PARAGRAPH ELEMENT, WHY DO I HAVE TO USE FUCKING HTMLENTITES FROM 2000?

FUCK'ERE

Comments
  • 3
    i feel sorry for the people who have to deal with frameworks
  • 9
    @rewriteitin-c You sound like a redditor
  • 1
    Another reason why angular > everyone else
  • 1
    @b2plane i would even code with jquery
  • 5
    The syntax is to ensure good state management, bad sate is the most common problem with vanilla js pr jquery and react is designed to try to enforce consistent state.

    If you do not understand why its as it is, chances are you also do not really get the benefits with react since it sounds your fighting the framework instead of embracing it.

    And if that is the case you probably should not use react, it might not suit your preferences.
  • 0
    @Voxera why embrace degeneracy?
  • 2
    @Areg Lets see your state management design.
  • 0
    "Notice that again, we are destructuring the returned values from useState.

    The first value, color, is our current state.

    The second value, setColor, is the function that is used to update our state."

    https://w3schools.com/react/...

    So it is destructuring like in Python / PHPs each / ...

    Two variables, one representing the value, other the callable / function.

    Is that what bothers you? The destructuring?
  • 1
    "react bad", something a rookie would say....
  • 0
    I guess it's about this seemingly atavistic need some devs have to shoehorn their framework into *everything*.

    I remember in my old company, I needed a task done. Taking UE4's web build artifact (a .js), and modifying a function so it could accept load requests from urls in addition to local packs.

    All it took was 5 lines and could be done in 30 mins.

    Fucker just *had* to fucking add Vue to the whole thing because it seems like "hurr durr no freemwork no brain".
  • 0
    @CoreFusionX ohhh boo hoo did someone criticise your favorite framework? How dare thee
  • 0
    If react is your favorite framework you're a soyboy
  • 0
    @IntrusionCM yesssssss it looks unnecessary
  • 0
    @jassole you had to comment twice because how salty you were 😂
  • 0
    @Areg damn, my feelings are hurt!!!

    How dare you insult my favourite framework React?

    But seriously, post how would you design it? You are sounding like a noob trying to be a smartass.
  • 0
    @jassole Anything but deconstructing it, why not have like a global function to set the state? like setState({yourshithere}) and then access it using this.state.myshit? or even better why not create a file that will include everything that should be set up in a state file? instead of cluttering it all over in the files.
  • 0
    @Areg If you are talking about a global state, you can already do that using the context api.

    https://react.dev/learn/...

    But afaik all major frameworks start out with local state.

    React with classes used to have `setState` but in general hooks provide more reusability. That said, I don't prefer react in general myself.
  • 0
    @Areg

    In which moment did it seem to you I was hurt because anyone criticised my favourite framework?

    It's clear from my post that my favourite framework is none. And people shoehorning them in the simplest of situations really grinds my gears.
  • 0
    @CoreFusionX shame you only have gears to grind
  • -1
    @ostream suck my dick and ballz instead
  • 2
    @Areg because it would be an anti pattern...

    You have a component. A component is an independent and reusable part of the whole react app.

    A global state, as in a state shared between components, should be avoided.

    Is possible with context if I remember correctly, but ... Unless it's necessary, don't do it. Keep the components independent, as that makes it far easier to maintain / extend and reuse them.

    A component itself doesn't need to have a single state.

    It can have multiple states.

    Destructuring is actually a nice pattern - common in many languages - to reduce boilerplate code.

    It also prevents funkyness regarding JavaScripts object handling.

    const object is not the same as const { value1, value2 }.

    const is a VERY misnomed thing in Javascript...

    An object in const isn't immutable.

    https://developer.mozilla.org/en-US...
  • 0
    @IntrusionCM i totally understand, but why would i ever need to deconstruct it? Why should i always have the option to "name" my own setter and getter? its absolutely stupid
  • 0
    @Areg

    You *can* set your own names when destructuring, by using the

    let {prop: newname, prop2: anothername} = someobject;
  • 0
    @CoreFusionX when did i ask for this?
  • 0
    @Areg You do not “need” to deconstruct it but since useState returns an array with two objects, using the array to get the state and to update will make the code less readable.

    Yes, they could have returned an object with and value prop and an update method but that would also in many cases lead to more cluttered code.

    In the end its just a design choice they made and one that most users of the framework likes or accepts.

    Just like the = for assignment and ==/=== for comparison instead of := for assignment and = for comparison.

    Destructuring is as mentioned a common pattern that is used quite extensively and they are using it consistently which is good.
  • 0
    @Voxera its even worse that way
  • 0
    So far I've only heard noobish suggestions on how to rearchitect it. Which is just complains about minor syntactic change and remaining be solved using 1 - 2 most popular state management libraries ....

    NOOOB PUBERTY BOY WHO PRECUMS seeing react CONFIRMED!!!!!
  • 2
    Good read, to whom it matters react is not a framework but view rendering library. It has grown and changed a lot overtime. If you dont like hooks, I believe class components are still available, just not widely used. Im fairly sure after understanding shortcomings of class components hooks will start making more sense. If not liking react there is plenty of alternatives especially when not interested in setting up plumbing. Maybe go for something else?
  • 0
    @Areg then you should not use react, they have made their decisions and react have grown to be one of the most used libraries so obviously not everyone share your opinion of it.

    Go find one that suits you better, or why mot build your own and prove that you can do better :)
  • 0
    @Areg The rant shows a lot about your character...

    Especially the negative sides.
  • 1
    @Areg It matters bro.
  • 0
    @IntrusionCM you're a moron for not understanding its a joke
  • 0
    @Areg yet another prime example of negative character traits.
  • 0
    @IntrusionCM yet another example that you're an idiot
Add Comment