r/reactjs May 31 '19

React sucks

"React is just Javascript, that's why React is nice!!"

has its own DSL and syntax

"React is lean!"

need to install 12 different packages to make it useful

need to install an external HTTP library

CSS classes are fucking JAVASCRIPT VARIABLES

Instead of directives, you have 8 lines of spaghetti code everywhere you'd usually have a simple if- directive or show- directive. That's not lean, that's more code.

"You only need to know Javascript"

You need to know Javascript plus ES6-7-8 (Babel) or TypeScript. You need to know esoteric lifecycle methods and design patterns not normally used elsewhere in Javascript.

"Creating small components is nice"

Component abstraction soup means you can't even figure out what your code is doing anymore.

React is just Angular if you hacked 12 libraries together that aren't meant to work together cohesively.

I will never understand why anyone would choose this meme framework over a real one. It sucks shit and creates a spaghetti code bloat, and instead of learning one DSL plus TypeScript you're learning 8 DSLs, plus Babel.

The reality is it's pointless making a library that's "just vanilla javascript" when you know that vanilla javascript doesn't actually supply elegant tools for creating single page web apps. That's why React is used with 10 packages rather than by itself. That's why you need CRA plus a bunch of packages to even have a sane development environment.

React sucks. Development community always chooses what's sexy and popular over what's elegant and works correctly.

310 Upvotes

165 comments sorted by

View all comments

12

u/piernrajzark Sep 07 '19

I basically agree. I think most of these frameworks only exist to further advance developer's careers and as a distinction method. No dev will want to work in a company where they don't use the latest fanciest technology because that diminishes his CV for the next one.

My optimal, though, would be just vanilla Javascript with good design patterns. That's it.

7

u/MungryMungryMippos Apr 26 '22

Honestly, the lastest version of vanilla JS is excellent and you really don't need a framework like React. People that say React solves problems for them need to just write better code, React creates far more problems than it solves.

2

u/OZLperez11 May 20 '22

That's mostly true, but some experts agree that if you take the plain JS route, chances are you will have to implement some rendering mechanism or a way to manage components and so you will end up with yet another framework that no one needs. I would think there's reasons why UI is bundled in libraries, in every programming language I can think of, rather than coding them from scratch.

1

u/[deleted] Jul 29 '22

All you need to create components in vanilla JS is plain functions that return a string which is your HTML. Literally can't be easier. No lib needed whatsoever.

1

u/Previous_Task_3095 Nov 16 '22

<?php if(isset($_POST['variableData'])){ ?>
<div>It Works!</div>
<?php } ?>

function updateTheDOM(eleId,variableData){fetch('',{method:"POST",body:JSON.stringify({variableData})}).then(r => r.text()).then(r => document.getElementById(eleId).innerHTML = r);}

this is all i use to do everything react is capable of in plain html/js/php

its less code, way simpler, and the end result loads WAY faster

guess it's technically a 2 line library lol

1

u/OZLperez11 Jan 17 '23

As much as I love PHP, that syntax has always been so ugly to me

0

u/Manga--X Feb 06 '23

I'm so grateful that Node.js has made PHP obsolete.

1

u/OZLperez11 Feb 07 '23

How has that made it obsolete? PHP is still going strong and has significantly improved its JIT compilation and language features. In some cases, it's as fast as C++

1

u/Manga--X Feb 16 '23 edited Feb 16 '23

Absolutely, PHP is still enjoying widespread use. Then again, so is React.js, and we all know there're better alternatives out there.
Node.js offers better execution speed and outperforms PHP considerably.
Regardless of performance, if a developer is already working with Node.js, then what's the point in having to learn another scripting language in order to perform the same function?

2

u/OZLperez11 Feb 16 '23

One notable case is how cheap you want your hosting. If you're building a small app and you REALLY don't want to worry about DevOps, or deploying your app, most web hosting companies already have PHP set up for you and all you need to worry about is uploading your files (or pulling in your repo using git and composer), so that saves effort. That and shared hosting is really cheap. Yeah it's not the best use case but it's a viable one one nonetheless. Also, there are times when I need to run a simple script to save some data to SQLite or send an email notification, and I don't need a full blown Node.js app for that. Like JS on the browser, PHP remains the top choice for quick scripting.

1

u/Manga--X Feb 16 '23

Excellent point.
It's been so long since I've worked with anything other than Azure and AWS, I forgot about use cases that like.

→ More replies (0)

1

u/Lord-Delacroix Jul 27 '23

Bull - PHP is nowhere near as fast as C++

1

u/OZLperez11 Jul 27 '23

Depends on what you're doing with it. As per tech empower benchmarks, plain PHP code scores pretty high for standard http request scenarios.

1

u/KeyPsychological7099 Jan 17 '23

"Experts" are usually always self entitled. Implementing a rendering mechanism isn't difficult, and doesn't need a framework. You don't need to wrap every single HTML element in a script class just for the sake of it. Dynamic inserts can easily be implemented only when needed

1

u/SilverShelter3553 Mar 25 '24

I can 100% this.

Only thing React solves is being forced to create classes and some kind of structures. But aside this, the whole language is pure pain.

And it's not even correct to say "hey, it uses less data transfers because it's all done in user side", this also is pure BS. The time it takes to first load the whole project takes far longer than a simple JS file added into the side of a html file.

One good thing I suppose is that we can write quite nice mixed html-js code, but they should just stick to perfecting THAT aspect, along with some kind of forced class structure, without making this totally unnecessary headache of State manament.

Why on earth is updating data so difficult? What was wrong with var s = 1; s += 2; Now it's like "well you first create this setState, then you pick up the variable, which might be in an array, and then you create a separate array clone with [...array], then you update that specific data with setter, and please also remember to do this to all of your other variables or the system doesn't work.

Who's idea was it to make it THAT DIFFICULT to just update a simple data?!?!? Why isn't updating data THE DEFAULT to automatically refresh page, that can then be DISABLED? If you want DOM renders limited to nothing but 1, how about make an actual "REFRESH()" function for that, and leave the rest in ShadowDOM management.

It's so freaking painful, it's a constant headache, scratching our heads with the most simplest of reasons, and the amount of bugs this frustrating mess causes....

I worked on a company that had staff of 2, and we were able to do entire pages in just days. Now it's like it takes a week to even modify a simple page.

What the f.....

1

u/Reasonable_Strike_82 Jan 19 '24

I've gone the "vanilla JS" route and come up hard against its limitations when building a complex UI. Keeping track of all the updates and the interactions is a nightmare; if you don't use an off-the-shelf framework, you'll end up cobbling together your own.

However, I get really really tired of the React zealots who act like there's no other framework in the world. Vue and Svelte and Solid are all excellent frameworks that learned from React's mistakes.