News for hackers. Stuff that matters.
Re:Understanding React Compiler by meiraleal on Friday June 28, 2024 @08:45AM (#40820086)
For almost 10 years, the core react developers would repeat incessantly: React is a library, not a framework.

In the past 2 or 3 years, they just "gave" up, turned it into the biggest most bloated framework in the frontend area while the official Web APIs in the browsers evolved so much that React is actually completely useless and now it is completely useless with a compiler.

I'm wondering if that was actually the reason they pivoted to this Frankstein? The loss of relevance as a frontend library.

Anyway, I jumped off the bandwagon and don't have a say in this fight anymore. But I'm doing my part advising every Junior Developer to not make the mistake of choosing React today.

Re:Understanding React Compiler by mitemte on Friday June 28, 2024 @09:03AM (#40820229)
Is React irrelevant? Stack Overflow’s 2023 developer survey places it first overall for web technologies [1]. I’ve always considered React to be one of the more straightforward front end libraries, so it’s surprising to hear it being called bloated.

1. https://survey.stackoverflow.co/2023/#section-most-popular-t...

Re:Understanding React Compiler by ttfkam on Friday June 28, 2024 @10:49AM (#40821148)
The fact that you have to go to often heroic measures to keep your bundle size under 500KB even for simple apps doesn't make it irrelevant or useless. It is indeed bloated: on the development boilerplate side, the bundling/deployment side, and the browser runtime experience.

With an experienced and top-notch developer, anything is possible in any language or framework. For the other 95% of devs out there—especially on a team where the lead doesn't keep a strong grip on the reins—React turns to mud awfully fast. But it's mud with an extensive ecosystem and tons of inertia helping it succeed.

Re:Understanding React Compiler by plazma on Sunday June 30, 2024 @02:11AM (#40835422)
You nailed it, this is exactly my experience.
Re:Understanding React Compiler by azangru on Friday June 28, 2024 @11:26AM (#40821624)
> Is React irrelevant? Stack Overflow’s 2023 developer survey places it first overall for web technologies

Consider jQuery. It was extremely popular once; was super influential to the point that some of its apis were adopted by the browser; is completely irrelevant now; but is taking a long time to die. I've been wondering whether React is destined to repeat this trajectory.

Re:Understanding React Compiler by neolefty on Friday June 28, 2024 @10:45AM (#40821085)
The worst library except for all the others? The complexities are there for good reasons IMO; I also like React — and I look forward to the compiler allowing simpler code.
Re:Understanding React Compiler by afavour on Friday June 28, 2024 @09:25AM (#40820415)
I strongly dislike React (not to be a hipster but I have for years!) but I wouldn’t advise junior developers avoid it. Like it not React is still the de facto standard, if I tell someone who doesn’t know better to avoid it I’m harming their career.
Re:Understanding React Compiler by meiraleal on Friday June 28, 2024 @09:30AM (#40820462)
No, you are not. The complexity of a React app is pure madness.

The bloat in the ecosystem of (mostly) abandoned packages is unparalleled. With the bloat comes the need to tree-shake, bundle, compiling, things that are not needed in modern web development but takes a good amount of the dev cognitive load when developing a React app.

There are great alternatives nowadays that don't come with the bad recent decisions of React: Solid, Lit, even vue or svelte.

Re:Understanding React Compiler by afavour on Friday June 28, 2024 @10:34AM (#40820981)
As you may recall I said I strongly dislike React. You are preaching to the converted with your complaints. That does not alter the fact that junior developer needs to know React since for better or worse (worse) it is the de-facto standard for front-end development at the moment.
Re:Understanding React Compiler by meiraleal on Friday June 28, 2024 @02:07PM (#40823269)
I’m discussing tech, while you’re discussing anthropology. Should people use an inferior tool to achieve a higher social status/paycheck? I don't know, that's your opinion.

Do I recommend someone learn React to develop a web app nowadays? No, it's not worth it.

I'm not preaching to you, but to the juniors reading the thread. React contributes significantly to current JavaScript fatigue, and supporting it so juniors can get a job isn't in my or their best interest.

Re:Understanding React Compiler by afavour on Friday June 28, 2024 @03:37PM (#40824381)
> I’m discussing tech, while you’re discussing anthropology

I’m discussing career advice. Something junior developers look to senior developers for. If your advice to your juniors results in them having fewer employment opportunities then you’re not doing a good job as a mentor.

> Do I recommend someone learn React to develop a web app nowadays? No, it's not worth it.

In what way is it not worth it? The majority of front end dev is done in React. Of course it’s worth it, even if it’s shitty.

Re:Understanding React Compiler by thoughtpalette on Friday June 28, 2024 @05:32PM (#40825510)
FWIW I agree with you. I think in the Last "State of JS" and/or StackOverflow surveys, React usage was still like 88%+ for front end devs/engineers.

You'd be putting yourself at a disadvantage in the field (employment wise) not learning at least some basics. Especially if you're just trying to get your foot in the door. It's already hard to 'break in' but even harder in this hiring climate.

Re:Understanding React Compiler by dsabanin on Friday June 28, 2024 @12:25PM (#40822223)
They don’t have the ecosystem that makes React worth it.
Re:Understanding React Compiler by dimmke on Friday June 28, 2024 @10:10AM (#40820761)
I jumped off and started using Svelte but have now found looking at job listings all the non tech companies are still using Angular and all the startups/tech centric companies are using Next.js.

I feel like from an employability perspective I shot myself in the foot, but I also dislike both of those frameworks. So maybe I should just quit being a front-end developer and try to retrain as something else.

Re:Understanding React Compiler by ttfkam on Friday June 28, 2024 @10:28AM (#40820921)
I like Svelte too, but take another look at Angular. Your memories of Angular 9 don't match up anymore. It's A LOT more streamlined now with so much less boilerplate than before. And signals.

That said, transitioning to some backend or infrastructure focus never hurt anyone. It's good to see problems from different perspectives and roles. No one ever got fired for knowing too much SQL.

Re:Understanding React Compiler by willsmith72 on Friday June 28, 2024 @02:14PM (#40823362)
It's just a frontend framework.

If you already have fundamental web dev knowledge, you'll be able to switch between them easily.

That's why I like Remix. It's react + web fundamentals. I'm happy to jump into a Vue, svelte, angular project. It's not all that different

Re:Understanding React Compiler by dimmke on Friday June 28, 2024 @05:57PM (#40825691)
Yeah, obviously however if you don't have previous experience with a framework in your résumé, they're going to choose the people that do.
Re:Understanding React Compiler by tuyiown on Friday June 28, 2024 @08:48AM (#40820112)
> advising every Junior Developer to not make the mistake of choosing React

I don't like react much, but I surely hope you advise them on ways to organise state management and rendering with good ways to track event listeners.

Re:Understanding React Compiler by naught0 on Friday June 28, 2024 @09:40AM (#40820526)
React is the premier frontend framework because it is easy to learn, scales ad infinitum, and has reached a critical mass where the library support is second to none.

Anyone advising juniors against learning React is shooting them in both feet, not least because of the demand for React developers.

Re:Understanding React Compiler by ttfkam on Friday June 28, 2024 @10:59AM (#40821276)
Learn JavaScript first, then React. Far too many devs know the React APIs without any context. If you know JS/TS, any framework is learnable. If you don't, your React code will never improve past mediocre and bloated.

Strong foundational knowledge in HTML and CSS helps as well. Still amazes me how many folks put onclick handlers on div tags and freak out when margins collapse.

Re:Understanding React Compiler by TonyAlicea10 on Friday June 28, 2024 @11:54AM (#40821914)
Fundamentals before frameworks. I've been a tech educator for a decade now, and still see this so much.
Re:Understanding React Compiler by vasergen on Friday June 28, 2024 @10:10AM (#40820755)
I am not a front-end developer. What are better alternatives to React nowadays?
Re:Understanding React Compiler by ttfkam on Friday June 28, 2024 @10:41AM (#40821047)
Depends on your goals/focus:

Smaller, cleaner, and faster code while still focusing on dynamic interfaces? Svelte or SolidJS

Focus on server-side HTML rendering with little to no browser dynamism? PHP (It really is quite nice now.)

Focus on server-side HTML rendering with some browser dynamism? HTMX + server framework (PHP, Django, Go templates, etc.)

Getting a job as quickly and easily as possible, especially at larger companies? React or Angular (You're a cog in the machine, but cogs often get better paychecks to deal with multi-megabyte code blobs.)

Can't decide between code elegance/performance and finding a job, so you're willing to compromise a little on both? Vue

Re:Understanding React Compiler by whalesalad on Friday June 28, 2024 @10:46AM (#40821096)
Vue 100%
Re:Understanding React Compiler by neolefty on Friday June 28, 2024 @10:53AM (#40821184)
React really is pretty good as long as it keeps evolving. Innovations tend to come from new frameworks such as Svelte and SolidJS, and then React adopts them — this new compiler is an example.

React is hobbled by the need to retain backward compatibility, but it is boosted by sheer scale and a solid underlying philosophy, design, and engineering.

Someday, we will probably find a fundamentally better philosophy for UI frameworks, but I don't know yet what it will be. React replaced its MVC predecessors with a functional approach, the Flux model.

Re:Understanding React Compiler by nox101 on Friday June 28, 2024 @01:09PM (#40822675)
Lit?

AFAICT, if you pick any of the others options you'll have to refactor your site every 3-4 years as all the tools bit rot. One won't run on the latest version of node so you upgrade node. Now 2 other libraries fail and require an upgrade. Now another library fails because it's not compatible with those upgrades, repeat. You thought you were just going to fix a bug or add a small feature that would take you a few hours but now you've got few days/weeks of refactoring before you can even start.

Re:Understanding React Compiler by meiraleal on Friday June 28, 2024 @02:15PM (#40823371)
I'm with you on that. Lit is the way to go. It is in the 3.x version but it never released a real breaking change but also it doesn't carry bloat for compatibility as it is a thin layer on browser APIs. The core dev team is great too, not looking to jump the next hype bandwagon.

WebComponents are the future (and the present) of web development.

Re:Understanding React Compiler by meiraleal on Friday June 28, 2024 @02:12PM (#40823331)
Lit, for sure.

Now is WebComponents prime time. Libraries like Lit have just a little bit of code that makes the DX of webcomponents be top notch. Some people like to use TS with it but what I love about lit is how powerful it is with just vanilla JS and no compile/bundling/building phase. Development directly in the browser, sane stack traces and faster than anything I've seen.

Lit code is similar to what React was until the 16 version.

Re:Understanding React Compiler by willsmith72 on Friday June 28, 2024 @02:18PM (#40823403)
No... You should learn the most popular frameworks. Why just react? Build the same project with svelte, Vue, angular. You'll learn a lot which applies across any web framework, that's more important.

If you're messing around and having fun, sure learn some hipster frameworks.

If you want to have highly saught -after skills years from now, basic web Dev with most popular frameworks on top is by far the safest bet.

Re:Understanding React Compiler by meiraleal on Friday June 28, 2024 @02:33PM (#40823583)
You should at least google (or ask chat GPT?) about Lit before calling it some hipster framework. Lit is the old Polymer.js and being under development for the past 10 years. Still small, still making the best use of web standards.

I agree with you about knowing a bit of most popular frameworks tho, they are quite interchangeable and very often adopt each others famous features. The biggest advantage of choosing Lit as your main tool is that it is the one that is more integrated with web components that won't go anywhere, anytime.

Re:Understanding React Compiler by willsmith72 on Friday June 28, 2024 @03:02PM (#40823950)
I know what lit is, a former colleague tried to pitch my manager on migrating to it because he too loved web components and we were investigating microfrontends.

Turns out, it's quite trivial to publish react and angular components as web compenents.

That completely took the value prop away from lit, and in terms of DX and library support, the other frameworks won easily

I'm not saying don't use smaller frameworks. I'm saying the safest future bet is learning the big ones

Re:Understanding React Compiler by rafark on Friday June 28, 2024 @01:29PM (#40822861)
>For almost 10 years, the core react developers would repeat incessantly: React is a library, not a framework.

I always disliked the it’s a library not a framework debate. Isn’t any library a framework, technically?

Re:Understanding React Compiler by erik_seaberg on Friday June 28, 2024 @03:42PM (#40824451)
You call a library as you see fit. A framework calls you.
Re:Understanding React Compiler by recursive on Friday June 28, 2024 @05:46PM (#40825608)
Oh yeah. I guess that's why we always invoke function components directly. Because it's a library.

/s

Re:Understanding React Compiler by throwAGIway on Saturday June 29, 2024 @09:39AM (#40830424)
What do you think you're doing when you call render(<App />,...)?
Re:Understanding React Compiler by recursive on Saturday June 29, 2024 @11:08AM (#40831128)
Not calling App. Creating a react element with a reference to the function. The reconciler will call it later, asynchronously. Put in some console logs and see the order of operations for yourself.

Also, try calling App and see what happens if it uses hooks.

Re:Understanding React Compiler by throwAGIway on Saturday June 29, 2024 @04:58PM (#40833313)
The createElement function is called immediately, and it immediately calls your component function. I don't think this is a significant difference. Many libraries accept a callback and I'm really not ready to call all that a framework just based on that.
Re:Understanding React Compiler by recursive on Saturday June 29, 2024 @06:57PM (#40833856)
createElement is immediate. The component function call is not. It may never be called. Try const a = <App />;

App() will never be called.

Re:Understanding React Compiler by throwAGIway on Sunday June 30, 2024 @02:40AM (#40835511)
Yeah, it will be called when you call render as in my original comment. Again, I don't think that passing a callback makes a framework.
Re:Understanding React Compiler by recursive on Sunday June 30, 2024 @11:31AM (#40837750)
When you combine that with the fact that you can't invoke the function directly, this seems like the textbook definition to me. Agree to disagree I guess.