News for hackers. Stuff that matters.
Re:Why I don't miss React: a story about using the platform by nawgz on Tuesday May 03, 2022 @07:27PM (#31254927)
That’s a pretty funny stance. The library has a gigantic developer share and is supported by a tech giant. A world where React isn’t used and remembered is one where the web isn’t based on the same primitive. The idea of a thin layer on top of JS offering composition is not complex, and the execution by react is still trend setting. Remember when they introduced hooks and now tons of libraries have the same thing? That’s not because React is behind the times and possible to supplant as a small team
Re:Why I don't miss React: a story about using the platform by croes on Tuesday May 03, 2022 @09:10PM (#31255657)
Applies the same to jQuery or Bootstrap?
Re:Why I don't miss React: a story about using the platform by dntrkv on Tuesday May 03, 2022 @09:37PM (#31255831)
Just a friendly reminder that React is approaching a decade in life. There are no other competing frameworks that look to be taking it’s place.

Not saying it will never go away, just that, maybe the front-end world has finally, significantly slowed down in churn. Things could always be better (Svelte is nice) but overall, React does what I need and I rarely curse at its design.

Re:Why I don't miss React: a story about using the platform by croes on Wednesday May 04, 2022 @12:55AM (#31256910)
How was the situation of jQuery 2014? Seems to me pretty similar. So in 2030, react will still be widely used but largely obsolete.
Re:Why I don't miss React: a story about using the platform by dntrkv on Wednesday May 04, 2022 @09:41AM (#31260237)
Not at all.

From jQuery’s release to 2014 there were multiple phases of front-end frameworks.

Backbone, Knockout, AngularJS, Ember. All of these had their time in the light during that phase. Most companies were already switched over to one of these frameworks. React was the new kid on the block at this time.

You Don’t Need jQuery was out well before 2014.

It’s also a bit difficult to compare jQuery since it’s a library that can linger in a codebase indefinitely. It’s not a framework.

Also jQuery release date was 2006, so the equivalent year 9 would be 2015. By which point React migrations were in full swing. I wrote my first on the job React + Flux application in 2014 and then joined a new larger company in 2015 where we were making plans for a React migration.

Re:Why I don't miss React: a story about using the platform by metadat on Tuesday May 03, 2022 @07:36PM (#31255000)
> The library has a gigantic developer share..

So did jQuery, and that google framework used to create Gmail, what was it called?

Oh yeah, nobody cares anymore because they're irrelevant in 2022.

Re:Why I don't miss React: a story about using the platform by leodriesch on Tuesday May 03, 2022 @07:44PM (#31255061)
And jQuery is still used in lots of places without any problems AFAIK.

Even if the React development team would stop the framework will for sure be around for a couple more years and receive at least security patches.

Re:Why I don't miss React: a story about using the platform by mst on Tuesday May 03, 2022 @10:36PM (#31256132)
I've worked on webapps that are part jquery, part classic angular, part react, and part angularjs.

My opinion of each of those parts has been primarily down to the developers, not the underlying choice of framework.

Things that work in production last.

Re:Why I don't miss React: a story about using the platform by metadat on Tuesday May 03, 2022 @07:46PM (#31255074)
jQuery has faded into the background, no longer interesting.

React has too many sharp edges, it'll only be here until something shinier supercedes it.

Re:Why I don't miss React: a story about using the platform by danachow on Tuesday May 03, 2022 @08:01PM (#31255226)
> jQuery has faded into the background, no longer interesting.

It’s a mature, stable technology, still in wide use - and not really a competitor with react. That you claim it’s “no longer interesting” says more about your own preferences and ironically makes it sound that you are personally interested in the newest shiny fads - so I’m confused, what is your objection to react then?

Angular isn’t exactly dead - and is a more apt comparison.

Re:Why I don't miss React: a story about using the platform by steve_adams_86 on Tuesday May 03, 2022 @10:32PM (#31256105)
I’m currently job searching and actually came across several mentions of jquery in job descriptions. It’s still alive!

Edit: 3,700,000 downloads per week on npm alone. That’s not a complete or perfect representation of usage, but that’s a significant number

Re:Why I don't miss React: a story about using the platform by croes on Tuesday May 03, 2022 @09:14PM (#31255681)
What else do you need jQuery for? The most important parts are already included in the browser.
Re:Why I don't miss React: a story about using the platform by steve_adams_86 on Tuesday May 03, 2022 @10:35PM (#31256126)
Honestly I bet a significant portion of the code I have maintained (and even some I’ve written) was reinventing a wheel someone didn’t know existed. Not even out of a desire to solve a problem, but simply not realizing it was done already.

I suspect people still reach for jquery for similar reasons. They know it makes complicated stuff work, it’s reliable, they don’t need to think about the specifics of the problems it solves… As a result, they’re less likely to discover that it’s no longer necessary in the first place. They’ll just keep using it.

Re:Why I don't miss React: a story about using the platform by croes on Wednesday May 04, 2022 @12:58AM (#31256920)
The same will happen to react. React will become a victim of its success, because the more it is used the more likely its concepts will be integrated directly into the browser or ECMAScript
Re:Why I don't miss React: a story about using the platform by mhoad on Wednesday May 04, 2022 @07:12AM (#31258914)
Maybe this is less obvious if you’re deep in the React ecosystem and nothing else but I’d argue that React is already in early stages of a death spiral for a few reasons.

These mostly come down to

1. It’s no longer the fastest, in fact it’s barely competitive speed wise with many things that have come after it.

2. It’s architectured in such a way that it is fundamentally misaligned with the rest of many web standards (I.e the DOM) which made a lot of sense when it was released but is now a major liability.

3. It now has to ship around a lot of code that now lives natively inside the browser and is now rather bloated as a result compared to newer iterations such as Lit as mentioned in the article.

Personally, I think it’s fatal in the sense that they have painted themselves into a very specific corner with no obvious engineering solution to get them back on the standards path. Its problems as a result aren’t really fixable without major architectural changes that would fundamentally change the project. On top of that they are only going to get actively worse over time as more things get moved into the browser and they are still stuck shipping a bunch of JS code to do the same thing. In short they are on a bad long term path with no clear off ramp.

I wouldn’t start a major project in React in 2022 for something I wanted to be around in 5 years from now as a result.

Re:Why I don't miss React: a story about using the platform by metadat on Tuesday May 03, 2022 @08:32PM (#31255438)
Never said I wasn't partial to shiny.
Re:Why I don't miss React: a story about using the platform by semiquaver on Tuesday May 03, 2022 @09:21PM (#31255729)
jQuery was and continues to be just about as successful as it is possible for a project to be. The reason it’s no longer as widely used is because it essentially became part of the platform. Most of what jQuery does is now possible with platform APIs, and those APIs exist mostly thanks to jQuery proving their utility.

A similar thing happened to CoffeeScript: no one uses it anymore because nearly all of its good ideas made their way into JavaScript itself.

Re:Why I don't miss React: a story about using the platform by sebmellen on Tuesday May 03, 2022 @07:55PM (#31255167)
What sharp edges? (This is an honest, curious question.)

I don't find many sharp edges in day-to-day React work. I say this having once been a very strong proponent of framework-less frontends, before trying Vue, then Svelte, and then settling on React.

Re:Why I don't miss React: a story about using the platform by oorza on Tuesday May 03, 2022 @08:18PM (#31255348)
Does React itself have edges, or do your issues derive from other parts of the ecosystem (Redux, styled-components, MobX, whatever)?
Re:Why I don't miss React: a story about using the platform by ralusek on Tuesday May 03, 2022 @08:34PM (#31255446)
React has edges. Hooks are an anti-pattern with all kinds of footguns. Suspense is also a crazy anti-pattern by literally throwing and catching errors as a means for communicating between parts of the framework.

And this isn't an issue of me not understanding React or hooks, I would consider myself to be as expertly acquainted with hooks as it's possible to be.

Now, do I still use React for everything? Yes. Do I prefer hooks to class components? Also, yes.

Re:Why I don't miss React: a story about using the platform by eyelidlessness on Tuesday May 03, 2022 @09:16PM (#31255693)
> Suspense is also a crazy anti-pattern by literally throwing and catching errors as a means for communicating between parts of the framework.

Okay I can criticize React and its weird solutions until the cows come home, but this is a pretty weird one because it’s entirely an implementation detail. No one working with Suspense ever needs to know that’s how it works unless they’re building a library to be compatible with its behavior. Otherwise it’s just trivia.

Re:Why I don't miss React: a story about using the platform by branko_d on Wednesday May 04, 2022 @12:37AM (#31256811)
Wouldn't the debugger break on exception? So any exceptions used in "nonexceptional" situations have a potential to "pollute" the debugging experience?

Admittedly, I haven't tried debugging React 18 yet, so I don't know if that actually happens in practice.

Re:Why I don't miss React: a story about using the platform by eyelidlessness on Wednesday May 04, 2022 @01:57AM (#31257172)
Only if you set it to break on handled exceptions/Promise rejections. This isn’t new behavior in React 18, it’s been the mechanism used for Suspense since it was introduced. If you have used Suspense and haven’t had unexpected debugger pauses, that’s what you should expect going forward.
Re:Why I don't miss React: a story about using the platform by NatSydenham on Wednesday May 04, 2022 @04:52AM (#31258154)
I work primarily with React, and I'm curious - why do you consider hooks to be an anti-pattern? (This isn't a criticism, genuine curiosity)
Re:Why I don't miss React: a story about using the platform by ralusek on Wednesday May 04, 2022 @11:58AM (#31262249)
In practice, because they don't work the way most people think they work, and because it's really easy to screw up using them.

Hooks are called every render, which is a relatively transparent process that happens all of the time. All hooks have to be called every render, otherwise you're breaking the rules of hooks. The reason why is because the only way hooks know which hook they even are, is the order in which you call them.

For example, if I have

    const a = useRef(true);
    const b = useRef(false);
The only way react knows that the first value it should return the next time it renders is what I'm expecting to be value `a` is because that useRef is called first every render. These are all kinds of rules and assumptions about hooks that make them not behave at all like normal functions. I don't think people understand that, for useRef, for example, those two lines of code are run every render, passing in the initial starting values, which then react disregards after the initial render, and maintains a mapping of ref and state and memo etc values all by the order the hooks are called in. I see people use hooks in callbacks all of the time and just fundamentally not understand that they're doing it wrong.

Then there are all of the closure problems with useEffect and useCallback that I see people really struggle with.

And useState...lordie. The fact that it defers setting the state value, whereas useRef will immediately have its value updated. Deferring useState has caused so many bugs.

Re:Why I don't miss React: a story about using the platform by strken on Wednesday May 04, 2022 @06:30AM (#31258626)
I don't like them because they hide program state in innocuous-seeming function calls. Want to call useContext in a helper? It'll work, until it doesn't. Want to display a loading spinner? You'd better not have any useState calls below it. Want to see what hooks a function will use? You have to run it or go through each line of every piece of code it calls, they're not in any way declarative.

The programming paradigms I like best are declarative and make invalid or undefined behaviour impossible to represent. Hooks do the opposite: they're procedural, make it very easy to write a program that compiles with subtle errors, and don't have compile time checks to stop bad code.

Re:Why I don't miss React: a story about using the platform by nawgz on Tuesday May 03, 2022 @07:53PM (#31255148)
> jQuery

I still see it on resumes today.

> that google framework

Seriously, Google stuff is infamous for being smothered by Google itself, what's your point

> nobody cares anymore

Literally the only non-Google example you could think of is still popular. But jQuery wasn't a graceful idea with a strong implementation, it was a wrapper to alleviate the pain of browser APIs. React is a wrapper to alleviate the pain of JS. Thus my original claim: "[a] world where React isn’t used and remembered is one where the web isn’t based on the same primitives". I don't see that happening soon.

Re:Why I don't miss React: a story about using the platform by metadat on Tuesday May 03, 2022 @08:33PM (#31255440)
I'm not a frontend expert, please forgive me.
Re:Why I don't miss React: a story about using the platform by thayne on Wednesday May 04, 2022 @12:17AM (#31256711)
Web components might change those primatives. It is still pretty early days, but I would be surpriaed if react isn't replaced either by something built on web components, or maybe even native web components.
Re:Why I don't miss React: a story about using the platform by dmitriid on Wednesday May 04, 2022 @01:15AM (#31256997)
> It is still pretty early days

Web components were proposed 11 years ago. Widely available for at least six. When will it stop being "early days"?

Now all the air in browser development has been sucked out of the room by them. Instead of actually moving the web forward browsers are busy patching holes and problems created by web components because they are horrendously badly designed.

And they still have an issue list as long as the equator. Any framework in such a state in "early days" would be laughed out of the room.

Re:Why I don't miss React: a story about using the platform by thayne on Wednesday May 04, 2022 @02:26AM (#31257358)
> widely available for at least six

Custom Elements weren't available until 2018. So unless you are referring to the chrome-only experimental v0 version, I don't think you can say it has been widely available for more than 4. And there will likely be substantial improvements to it before it starts dominating web development.

Re:Why I don't miss React: a story about using the platform by dmitriid on Wednesday May 04, 2022 @04:07AM (#31257933)
> I don't think you can say it has been widely available for more than 4

Yes, my timeline was off.

> And there will likely be substantial improvements to it before it starts dominating web development.

I'm definitely veering away from my original statement, but here goes :)

There won't be any substantial improvements in web components. It's painfully obvious how many shortcomings they have, and how many holes have to be patched before they can become actually useful. I mean, they had to come up with a whole new Javascript API just to make them participate in forms.

And now their existence taints and poisons most other improvements to the platform. For example, Scoped CSS (which on its own would solve a huge chunk of what web components offer) now have to be twisted to accommodate web components, and will likely be a worse spec as a result.

Chrome "developer advocates" will incessantly berate and gaslight other projects and frameworks, and will claim that web components are a success because companies with billions of dollars in revenue and thousands of developers use them to create a yet another avatar or breadcrumbs component. That... that is neither success nor a path towards any substantial improvement.

"It's almost as if congealing 2010-era best practices in the platform before we'd finished exploring this territory was a mistake" [1] And the future is likely to be component-less [2]

If the tens of millions of dollars that Google alone has poured into Web Components had gone into something meaningful like https://open-ui.org we'd have a significantly better and a substantially more future-proof web. Alas.

[1] https://twitter.com/Rich_Harris/status/1513668040784814084

[2] https://dev.to/this-is-learning/components-are-pure-overhead...