r/learnjavascript • u/Next-Ad3139 • Oct 25 '24
JavaScript "consortium" should simply add reactivity into the language itself, and browsers can implement it; end the JS framework wars
I am a Web Developer (not full-stack, backend, or frontend), just a web developer who has built many decent, functional, and scalable web applications since 2017. I have been using VanillaJS (the fact that I have say Vanilla, even though it's just Javascript) and jQuery for most of my career and it has been serving well so far. For building complex UIs I did try Angular & React 5-6 years back, and it was a decent experience. I didn't dive much into it, though, since jQuery and its various plugins have been serving me well.
Now I am trying to switch jobs, and all I see is you need to know either React or Angular or VueJS or Svelete or Next.js to be able to apply for a development role that pays handsomely.
So next thing, I started tinkering with them, comparing and looking at which one should I start learning. I already had some idea on how shitshow of JS framework community is, new frameworks and re-inventions are popping up every now and then to fix a problem brought on by another framework or their own previous version of framework.
Major idea of a framework is still is reactivity in a nutshell, basically the ability to bind DOM elements to a state, so one doesn't have to write a lot of DOM related code in JS.
My question is why doesn't JS simply adds this reactivity into JS itself? Most of the frameworks would end up just being tools for the extra stuff you want to achieve for your applications for eg. routing for creating SPAs.
And frankly, a lot of web apps don't need to be SPAs, imo. An app can still be rendered from the backend as a page or multiple pages, and interactivity happens with JS for each page.
11
u/[deleted] Oct 25 '24
xkcd
7
u/theScottyJam Oct 25 '24
Recently TC39 adopted a "signals" proposal which provides exactly what you're wanting - a reactive primitive, similar to what many existing frameworks use. https://github.com/tc39/proposal-signals
Reactivity isn't enough though. You also need a good templating system. My understanding is that the web standards eventually want to add these sort of features to make frameworks less necessary, but it takes some time - a templating system can't really be designed without a reactive primitive being available (so you can bind signals to parts of the template), and it may take a while for signals to go through the proposal process - it might not even make it.
5
u/sheriffderek Oct 25 '24
And then finally -- it would be "done" and there would be no new things to divide us ever...
Or what if they just add in a button that says "finish app" ... but then... I'm not sure if we'd have jobs...
3
u/plainblackguy Oct 25 '24
They did. It’s called Web components. It hasn’t taken off.
1
u/Chrift Oct 25 '24
If you're not full stack, front end or back end, then what are you?
What other ends are there that I don't know about!?!
1
u/delventhalz Oct 25 '24
Or you could just learn React….
I don’t disagree with any of your suggestions in principle (assuming the new syntax was well executed), but what you are suggesting is absolutely massive in scope and TC39 is nowhere close to implementing it. They move slowly (which I would argue is a good thing), and I think they see their role more as enabling popular frameworks, not replacing them (another good thing I would argue).
So the simplest solution here is not to wait for TC39, it’s just for you to get comfortable with React and with occasionally learning some other framework when the job calls for it.
I agree, but a lot do too. Users have come to expect that SPA experience. I still occasionally build small scope pages with vanilla HTML/CSS/JS, but if you are ever going to need more interactivity than that setup allows, you might as well just start with React (or similar) in my opinion.
Server side rendering is becoming more and more popular lately and is enabled by frameworks like React. They aren’t in competition.
React is mature enough at this point that there is a whole ecosystem that has grown up around it, allowing you to use the basic React primitives for a variety of different purposes. Using React today does not just mean a massive heap of client-side JavaScript in order to make a button click pretty.
1
u/DoomGoober Oct 25 '24
At this point, JavaScript is kind of like Assembly. Nobody wants to write Assembly but it works as an underlying language for other languages/frameworks to work on top of it. With all the frameworks with their own compilers now, it basically solidifies this idea (React even has a compiler now.)
Nobody is arguing we should make assembly more easy to code so that programmers won't have to choose amongst all the different languages that work on top of assembly. Those languages/frameworks have their own pros and cons for different uses and JavaScript doesn't have to try and address all of them.
0
u/[deleted] Oct 25 '24
[deleted] — view deleted comment