Can't wait for the next 6-12 months of content slop videos by "influencers" talking about this as if it's going to literally change every single way you use React.
Seems scary to apply AST transformations to all components (how does it even know that a function is a component?), but the opt-in mode "use memo" looks like a pure win.
This might be an unpopular opinion, but: React shouldn't need a compiler. If your api has so many footguns it needs a compiler, your api design is bad.
Seriously, as much as I like react, most of the problems people run into with it were not an issue before hooks. At some point I wish people would just admit that we need a better solution, not more tooling to band-aid the problem.
Class components are a huge chore to split up into subcomponents and the equivalent of hooks (behavior) can't easily be broken out and reused. Hooks fix this.
Prefer whatever you want, but don't pretend hooks have zero advantage
I never said they have zero advantages. Please do not put words in my mouth. Hooks certainly did solve some problems, but it introduced many new ones at the same time. That's why what I'm saying is, rather than continue entrenching ourselves in this hole, perhaps we should consider alternative approaches to solving those problems.
We used to have so many new JS frameworks popping up back in the day, each with different takes to solving similar problems. Accepting that one solution may not be the best and trying something else was considered normal.
Maybe I’m thinking about it the wrong way, but I would expect them to write code that is already somewhat optimized since it’s Meta using Meta tools, so IMO a 12% increase is fairly decent.
For those who are maybe not as familiar with React or apps that are poorly written, may have a more impressive result in performance (but I’m just guessing).
The fact this compiler is needed is a clear sign of the leaky abstraction that is React. Svelte has done it the right way, updating exactly what is needed without memoization trickery, I encourage anyone who's interested to look into it.
I wish the React team had just developed some functional style programming language oriented towards front-end dev with good JS integration. It would have saved about 10 years of React development bending JS to be what it isn't.
Yes, not on the same level of abstraction though. Even without compiling, basically Svelte already does what this react compiler is trying to achieve, and even more surgically. Besides, there's still the other "compilation" steps like TS->JS transpilation, and webpack/rollup/bundling which applies to both Svelte and React (as well as nearly any other web framework). The word "compiler" is used very loosely anyway, but I'm specifically referring to the fact that React needs this extra transformation step to even remotely attempt to match what Svelte provides natively (and even then it does it worse).
Don't get me wrong, most of my personal projects and professional work experience have been in React and it works fine for the most part, but at some point you run into performance and/or state management issues that are a result of the deep rooted issues coming from the way React works, and Svelte just does this better.
The thing that turns .svelte into .js is a compiler. What do you mean with
Even without compiling, basically Svelte already does what this react compiler is trying to achieve
What are you gonna do with .svelte files without compiling them? Svelte does way more aggressive transformations than inserting useMemo aggressively. Which is cool, don't get me wrong, I also really like the jetpack compose compiler. But both are very much compilers.
Thats just pure insanity. Going from including a library from the server or a cdn to having a full fledged compiler. It feels somehow we got lost during the way here.
Even though you can use React like this, this usage is very rare. Most projects use a compilation step for React, so you wouldn't import it from the CDN.
However, I feel this compiler was meant to fix past mistakes. As for Svelte and Vue, it was there since the early days, so they were designed to be this way. (Although, Vue can be imported from a CDN too)
I mean most are using tsc + a bundler, so this means i now need an additional compiler to build my frontend (if using modern react). In my books that is not only overkill, but over engineered maximus.
Why not just release a new API and slowly deprecate the ones "that has past mistakes"?
Imagine if i need ro compile my C code twice with two different compilers every time i want to build for prod. Would not fly.
I mean, it's foundational improvements to a core primitive that underlies much of the frontend, it's going to be nerdy, mathematical, DSA stuff as opposed to the trivial CRUD wrapper microservices that are built atop these foundational technologies.
ReallySuperName@reddit
Can't wait for the next 6-12 months of content slop videos by "influencers" talking about this as if it's going to literally change every single way you use React.
billie_parker@reddit
The word "slop" has lost all meaning. Thanks, idiots
DescriptorTablesx86@reddit
Cambridge dictionary:
“Slop - content on the internet that is of very low quality”
I can’t wait for all the low quality content on the internet that’s going to milk this release like it’s about to change everything about React.
Idk seems proper to me
billie_parker@reddit
It literally came from 4chan to mean bad content created by jews for the goyim. But whatever, I guess we can't all be self aware.
dezsiszabi@reddit
You ok?
billie_parker@reddit
YoU oK?
dezsiszabi@reddit
Yes, I'm doing great, thanks for asking.
DorphinPack@reddit
I'd like to thank MiseryCo. for sponsoring this painfully slow recap of the announcement post on the React blog!
BlueGoliath@reddit
I can just see one of them doing a surprised Pikachu face looking towards the React logo for the thumbnail.
ReallySuperName@reddit
It's going to be some Theo video for sure
BlueGoliath@reddit
hapliniste@reddit
you guys are cracking me up
Atulin@reddit
It's moments like this I wish images in comments were enabled on this sub
umtala@reddit
Seems scary to apply AST transformations to all components (how does it even know that a function is a component?), but the opt-in mode "use memo" looks like a pure win.
atypeofcheese@reddit
Seems a bit underwhelming tbh. I wish they'd go into more detail about what these certain interactions were tho
anotherdevnick@reddit
The biggest improvement is really DX, not having to regularly think about memos regularly anymore is a win and will simplify components a lot
It’s too bad we only get babel out the gate though, the types of projects likely to adopt Compiler early are not using babel these days
Key-Celebration-1481@reddit
This might be an unpopular opinion, but: React shouldn't need a compiler. If your api has so many footguns it needs a compiler, your api design is bad.
Seriously, as much as I like react, most of the problems people run into with it were not an issue before hooks. At some point I wish people would just admit that we need a better solution, not more tooling to band-aid the problem.
PreciselyWrong@reddit
Class components are a huge chore to split up into subcomponents and the equivalent of hooks (behavior) can't easily be broken out and reused. Hooks fix this.
Prefer whatever you want, but don't pretend hooks have zero advantage
Key-Celebration-1481@reddit
I never said they have zero advantages. Please do not put words in my mouth. Hooks certainly did solve some problems, but it introduced many new ones at the same time. That's why what I'm saying is, rather than continue entrenching ourselves in this hole, perhaps we should consider alternative approaches to solving those problems.
We used to have so many new JS frameworks popping up back in the day, each with different takes to solving similar problems. Accepting that one solution may not be the best and trying something else was considered normal.
ShadowCatDLL@reddit
Maybe I’m thinking about it the wrong way, but I would expect them to write code that is already somewhat optimized since it’s Meta using Meta tools, so IMO a 12% increase is fairly decent.
For those who are maybe not as familiar with React or apps that are poorly written, may have a more impressive result in performance (but I’m just guessing).
BruhMomentConfirmed@reddit
The fact this compiler is needed is a clear sign of the leaky abstraction that is React. Svelte has done it the right way, updating exactly what is needed without memoization trickery, I encourage anyone who's interested to look into it.
sime@reddit
I wish the React team had just developed some functional style programming language oriented towards front-end dev with good JS integration. It would have saved about 10 years of React development bending JS to be what it isn't.
dual__88@reddit
You don't need the react team for that, there are already compilers that compile fp languages for web, for example Rescript.
aicis@reddit
But Svelte also has a compiler?
BruhMomentConfirmed@reddit
Yes, not on the same level of abstraction though. Even without compiling, basically Svelte already does what this react compiler is trying to achieve, and even more surgically. Besides, there's still the other "compilation" steps like TS->JS transpilation, and webpack/rollup/bundling which applies to both Svelte and React (as well as nearly any other web framework). The word "compiler" is used very loosely anyway, but I'm specifically referring to the fact that React needs this extra transformation step to even remotely attempt to match what Svelte provides natively (and even then it does it worse).
Don't get me wrong, most of my personal projects and professional work experience have been in React and it works fine for the most part, but at some point you run into performance and/or state management issues that are a result of the deep rooted issues coming from the way React works, and Svelte just does this better.
Tarmen@reddit
The thing that turns .svelte into .js is a compiler. What do you mean with
What are you gonna do with .svelte files without compiling them? Svelte does way more aggressive transformations than inserting useMemo aggressively. Which is cool, don't get me wrong, I also really like the jetpack compose compiler. But both are very much compilers.
SourcerorSoupreme@reddit
No offense but are you intentionally missing his point or just dense?
xtravar@reddit
It is good that they're releasing the release.
crecentfresh@reddit
They’re distributing the distribution
Pesthuf@reddit
They're done programming the program.
CodingReaction@reddit
They're pipelining the pipe
UnmaintainedDonkey@reddit
A compiler.. for a small ui library?!?! Why?
ematipico@reddit
Well, that's the trend nowadays. Vue has it, Svelte has it, Astro has it.
UnmaintainedDonkey@reddit
Thats just pure insanity. Going from including a library from the server or a cdn to having a full fledged compiler. It feels somehow we got lost during the way here.
ematipico@reddit
Even though you can use React like this, this usage is very rare. Most projects use a compilation step for React, so you wouldn't import it from the CDN.
However, I feel this compiler was meant to fix past mistakes. As for Svelte and Vue, it was there since the early days, so they were designed to be this way. (Although, Vue can be imported from a CDN too)
UnmaintainedDonkey@reddit
I mean most are using tsc + a bundler, so this means i now need an additional compiler to build my frontend (if using modern react). In my books that is not only overkill, but over engineered maximus.
Why not just release a new API and slowly deprecate the ones "that has past mistakes"?
Imagine if i need ro compile my C code twice with two different compilers every time i want to build for prod. Would not fly.
Absolute_Enema@reddit
keepmyeyesontheprice@reddit
Tell me you’re an enterprise software engineering team without telling me you’re an enterprise software engineering team.
del_rio@reddit
What part of Control Flow Graph based High-Level Intermediate Representation don't you understand? 😅
For real, I do wish this post was more framed towards intermediate devs, like actually showing a before-and-after of a TODO app.
teerre@reddit
Well, if you know anything about compilers, this blog post is very much intermediate level at worst
CircumspectCapybara@reddit
I mean, it's foundational improvements to a core primitive that underlies much of the frontend, it's going to be nerdy, mathematical, DSA stuff as opposed to the trivial CRUD wrapper microservices that are built atop these foundational technologies.
sime@reddit
I'm guessing this doesn't work for TypeScript code.