top | item 33394108

For all React coders out there, why and how?

6 points| damacaner | 3 years ago | reply

How do you guys constantly write React, let alone learning it? And why?

I am trying to learn it for two days (probably 12 hours by the time I write it) and... everything about it is pure annoyance that is shaped into a form of language.

Help from google? Nah fam it is outdated and not documented in official documentation.

Need sensible errors? .........fuck off.

Syntax? My eyes are burning.

Writing efficiency? You can write that code in 10 minutes, if you dont include the up-to-date package search on Google for 1.30 hours straight.

I will wait for many many years more for a language alternative to Javascript so I dont have to deal with this abomination. For whoever dealing with this and making life from it, how you all manage to keep your mental stability in balance?

11 comments

order
[+] iamnatch|3 years ago|reply
If you're learning React, you shouldn't let yourself get bogged down all the JS toolings, build tools, etc. It can all be quite overwhelming, and the best way to learn a new topic it to learn it in isolation before bringing those concepts into the big picture.

You can get started with this right away, simply type `react.new` into any browser and it will bring up a brand new, ready to go codesandbox in which you can write code, see your changes update live, save your drafts, and eventually download your code and run it direct on your machine. Even as an experienced React dev, I still spin these up all the time for little experiments and proofs.

Once you're ready to actually build a website, you'll probably want to start with an established framework like NextJS[0].

0: https://nextjs.org/docs

[+] ss108|3 years ago|reply
React very quickly turned into an over-complicated mess. The basic premise of "specify how the DOM should represent the data/look based on the state of the data, and when you update the data, the DOM will automatically update" is sound and was very useful. But all this stuff about hooks, and all the stuff with Redux that got very popular, was totally unnecessary. It's now a pain to perform the simple task of fetching data from an API and rendering it compared to the jQuery days.

That being said, I think your post is over-dramatic. Simple React apps for learning purposes shouldn't be too difficult or crazy. You may be overindulging in grouchiness and not giving it a chance.

Personally, I want to try something more minimalist like mithril.js at some point. I have heard good things about Svelte. It looks weird to me, but willing to give it a try.

[+] jfengel|3 years ago|reply
React is a pretty substantial shift for a lot of programmers, because it's intended to be "reactive" (thus, the name) and not imperative. You have to learn to think about things in the React way, and if you don't you're going to be fighting it.

Worse: the benefits of thinking that way are not really visible with small programs. Anything you can do in the "hello, world" range will seem harder than doing it in a conventional way.

Worst: React has gone through several substantial revisions, leaving a confused mishmash on Stackoverflow. The new ways are genuinely better, and the first few iterations were kind of a travesty.

Having gone through that pain, I find React very natural. It aims to be side-effect-free, which substantially aids debugging -- the bigger the program, the harder it is to figure out where some side effect occurred.

JSX seems to strike the right balance between HTML and code. A program "is" a web page... except when you need to escape out to Javascript, and you do that with a simple {}. That maps to how I think of a web page. (In fact, JSX is not HTML; you don't need React to write JSX and you don't need JSX to write React. And the differences can be genuinely maddening. But the lie of "It's HTML with some JS" is good enough for most days, especially when you jut start.)

There remain plenty of things to criticize about React, but when you just get started with it, most of the pain you experience will be shifting to its mindset. You'll be tempted to do things in the conventional way, and that's not going to work. It does actually become very fast to develop in because it reduces certain kinds of errors that require a lot of discipline to avoid in conventional DOM manipulation.

[+] user432678|3 years ago|reply
> how you all manage to keep your mental stability in balance?

I personally don’t anymore, and currently struggling to leave frontend development all together somewhere else (thinking of Golang). As other commenters have mentioned, React.js development wasn’t that complicated when it first was introduced to the public.

[+] toastal|3 years ago|reply
It was fine. But when it became too popular, just like trying to search anything about other popular languages like Python, the signal to noise of SEO spam makes it hard to find the good, relevant, and up-to-DAT info. As it got mainstreamed, things like JSX got mainstreamed too despite it adding way more complexity with a veneer of familarity.
[+] bjacobt|3 years ago|reply
I hope I’m not hijacking this thread, but if anyone knows what is the best way to start a react app (web) in 2022, can you share?

I build in angular but looking to switch to react since it’s more popular and I find it confusing what libraries to use and patterns to follow. Eg: class based or functional components

[+] savanaly|3 years ago|reply
The tutorials at the react home page should suit you well.
[+] skydhash|3 years ago|reply
Money. Nothing about it annoys me really, but while React is easy to get started with, it’s full of pitfalls à la C. So much of time when dealing with others’s, you see bad patterns everywhere. But it can be quite nice to work with as long you tailor the abstractions to your usage.
[+] kidgorgeous|3 years ago|reply
Real talk, the whole modern javascript ES7,8,whatever is to blame for the whole confusion imo. But all these modern javascript frameworks (angular, etc.) is designed to change browser state without triggering calls to the server (outside of async). That's extremely popular right now because the more your site lags, and lags behind the competition, the more market share you lose. So that's the whole economic reason behind why these frameworks are popular in a nutshell. look at everything from a business perspective.
[+] damacaner|3 years ago|reply
Everything from a business perspective always sounds non-sense to me.

I cant even find a library or language to code front-end, like I am burning my time since six days to find something that is dev-friendly. Everything is just, is it secure or fast? yeah ship it, we dont care about how developers feel about it.

really sad.

[+] beardyw|3 years ago|reply
In the end it is JavaScript and everything can be done without any packages. There is no magic in them.