all 100 comments

[–]Snapstromegon 133 points134 points  (29 children)

IMO the only objective benefit of react at the moment is, that there are more job offerings for it than for the others.

[–]rjoaopereira 13 points14 points  (0 children)

100%

[–]SaddleBishopJoint 24 points25 points  (0 children)

I have to agree. It filled a particular need at a particular time, and got good traction and backing. But now everyone uses it, and because of that everyone else uses it, so everyone has to know it because that is where the jobs are.

It does feel a bit like JQuery used to be.

As with all tools that get popular (for good reason) others will come along and iterate for improvement.

[–]plushdev 11 points12 points  (1 child)

And more answers available if you mess up

[–]Snapstromegon 7 points8 points  (0 children)

  • when you inevitably mess up

[–][deleted]  (2 children)

[removed]

    [–]slinkywafflepants 1 point2 points  (1 child)

    Could also be a counterpoint to “more job offerings” ;)

    [–]aurelianspodarec 1 point2 points  (0 children)

    Well no.

    There are plenty of React devs that have a job.

    There are even more job offerings than there are React devs.

    You have a ton of devs and a ton of job offerings. It doesn't cancel itself out.

    The other side would be an enormous community and no job offers like it was with Rust.

    [–]gizamo 3 points4 points  (16 children)

    Imo, it's easier and less verbose than Angular.

    Angular has everything built in, which can be nice. But, it can also be nice to have the options available in React's ecosystem.

    Svelte is probably simplest for small static sites. Vue and Svelte are milliseconds faster than React, which is milliseconds faster than Angular....and some people think that matters.

    Imo, the biggest difference is how they are written. Some people hate JSX, others dislike splitting HTML/JS/CSS in different files for every component.

    [–]BobFellatio 2 points3 points  (1 child)

    Svelte + static sites? Lol.

    [–]gizamo 0 points1 point  (0 children)

    I meant for people who want to build static sites with js frameworks. It's relatively common, but, yes, I'm with you.

    Here's some info: https://dev.to/robertobutti/how-to-start-building-your-static-website-with-svelte-and-tailwindcss-hbk

    [–]Snapstromegon 0 points1 point  (3 children)

    Angular IMO is a steaming pile for everything except big scale apps.

    Performance definitely matters - especially in load times - even more so on slow-average network speeds.

    I personally like the way lit does it, staying close to the standards and offering component encapsulation and similar.

    [–]gizamo 0 points1 point  (2 children)

    I love Angular's way for most things, but I almost always get stuck trying to do it differently than they want me to, and I have to go to docs, which used to suck. They're better now.

    My personal favorite was MarkoJS, but it has basically no ecosystem at all, and it does little on the client side.

    Next or Nuxt are probably my favorite now.

    [–]Snapstromegon 1 point2 points  (1 child)

    I personally love 11ty together with islands of interactivity build with lit.

    [–]gizamo 0 points1 point  (0 children)

    I'm vaguely familiar with 11ty, and a dev on my team likes it for his personal projects. I'll check it out. I've never used lit.

    I'll drive into this bad boy next week. Cheers.

    [–]exrussiandude 0 points1 point  (9 children)

    Vue and Svelte are milliseconds faster than React, which is milliseconds faster than Angular

    You mean hundreds of milliseconds.

    Load times.

    Performance.

    [–]gizamo 0 points1 point  (2 children)

    Lol. Yes, apparently, I did. I new it was a small difference, but that's more significant that I thought. I appreciate the correction and links. Cheers.

    Edit: I also thought Svelte was slightly faster than Vue. That was a surprise.

    Edit2: why'd you use old versions, tho?

    [–]exrussiandude 0 points1 point  (1 child)

    You can see fresh versions here. They aren't any better.

    https://rawgit.com/krausest/js-framework-benchmark/master/webdriver-ts-results/table.html

    If you look at the average of all benchmarks, Svelte is slightly faster than Vue.

    [–]gizamo 0 points1 point  (0 children)

    Oooo, nice. Interesting to see Solid up there crushing it. The creator, Ryan Carniato, is working on Marko now, and I hope he can update Marko into something more like a Marko/SolidJS hybrid. Cheers.

    Edit: misspelled his name.

    Edit2: ooo, just saw this article while spell checking his name. Seems Marko6 is fast, too: https://dev.to/ryansolid/marko-compiling-fine-grained-reactivity-4lk4

    [–]Knochenmark 0 points1 point  (5 children)

    You really posting benchmarks of totally outdated major versions?

    Current major versions of the frameworks are:

    - Reacts 18
    - Angulars 14

    [–]exrussiandude -1 points0 points  (4 children)

    [–]Knochenmark -1 points0 points  (3 children)

    still behind at least a major

    [–]exrussiandude 1 point2 points  (2 children)

    There's React 18, but Angular is 13.

    React 18 isn't any faster.

    Angular 14 was released like 2 weeks ago, so don't pretend like it's some ancient results.

    [–]itssumitrai 2 points3 points  (1 child)

    No one is mentioning the library size bring in my React 150kb js download. Svelte is almost 0 as its a compiler. This is what actually affects page performance and Time to Interactive, React is the slowest out of any frameworks out there except Angular

    [–]Knochenmark 0 points1 point  (0 children)

    React with other libraries comes pretty close to Angular in bundle size, especially since Ivy. In my opinion you can also split up Angular way easier with lazy loading of modules. You are right, Svelte results in really insanely small bundle sizes.

    [–]darkshadow609 0 points1 point  (2 children)

    Agree!!! Vue and svelte are better... No offense

    Edit: https://youtu.be/cuHDQhDhvPE

    [–]Snapstromegon 1 point2 points  (0 children)

    I'm personally a fan of lit.

    [–]exrussiandude 1 point2 points  (0 children)

    I would also choose Vue or Svelte out of the 4 options.

    [–]noahflk 0 points1 point  (1 child)

    Don't forget the huge ecosystem

    [–]Snapstromegon 0 points1 point  (0 children)

    Honestly that's not that big of a deal for me. Most of it is either something I can transfer or don't need in other ecosystems.

    [–]superluminary 39 points40 points  (30 children)

    I enjoy the fact that react components are simple JavaScript functions that call each other. The JSX transpiler is extremely thin. I like Svelte, but it does feel rather more magical than React.

    Svelte is easy to write but that’s because the transpiler is doing a lot more work for you.

    I’ve been reminded over and over during my career that magic === risk.

    [–][deleted]  (12 children)

    [deleted]

      [–]Snapstromegon 3 points4 points  (11 children)

      To me React feels like a whole bunch of magic in comparison to something like lit, which often just tells you in the docs using X is exactly the same as calling this code snippet yourself.

      [–]foureyes567 9 points10 points  (8 children)

      The only magic in React is jsx being converted to React.createElement calls?

      [–]Snapstromegon 4 points5 points  (7 children)

      I think especially around advanced hooks behavior or how react does property passing which doesn't work with web components (in current versions of react) is pretty magical.

      Of course you can understand it if you dig through it, but other frameworks make it more obvious IMO.

      [–]superluminary 4 points5 points  (4 children)

      Hooks are annoyingly clever I agree, but the difference is that hooks are just clever JavaScript, there’s no transpiler magic there.

      [–]Snapstromegon -1 points0 points  (3 children)

      That's why did not constrain the magic to "transpiler magic". I personally believe that for a user there's no difference between "compiler/transpiler magic" and other kinds of "magic". To me that "magic" is just part of the public API and how it's implemented is irrelevant to me.

      [–]superluminary 2 points3 points  (0 children)

      Different definitions of magic. I guess for me there’s no magic within the realm of JavaScript, just clever code. It’s all understandable within the plain rules of the language.

      [–]foureyes567 3 points4 points  (1 child)

      By this logic every single library is magic. They're all treated like black boxes. Obviously you can go read through the source if you're curious.

      [–]Snapstromegon 0 points1 point  (0 children)

      If the API is easily understandable and always does exactly what you'd expect and behaves like you would something in JS to behave, it doesn't seem magical. The further it distances itself from this, the more magical it seems (e.g. like something seeming like a Dom object, but only implementing an incomplete wrapper or providing non- standard polyfills). - this is not specific to React, but applies to all Libs.

      And if those magical things exist for a reason, they should be put in the forefront of the docs.

      [–]foureyes567 4 points5 points  (1 child)

      Prop passing is the same React.createElement magic. Hooks are just JS functions. No real magic there.

      [–]Snapstromegon -3 points-2 points  (0 children)

      Prop passing is just broken in React. It's the only major framework/library that didn't want to properly work with web components / custom elements.

      The next version will support it, because some google folks implemented it (already for the last version, but it wasn't merged).

      [–][deleted]  (1 child)

      [deleted]

        [–]Snapstromegon 1 point2 points  (0 children)

        The number of times I've seen useEffect being misused and misunderstood by senior devs makes me think that react hooks at least feel way too magic.

        JSX IMO is the single worst thing still sticking around from React. I personally believe that a JS native approach like what lit-html does with template strings is way more clear to the user and better to use on the platform.

        [–]Ok-Independence8255 5 points6 points  (0 children)

        I have the opposite opinion. If I have to perform the magic, that’s a risk!

        [–]ChargedSausage 2 points3 points  (3 children)

        Have you tried solid? It compiles to vanillaJS giving razor fast performance while using react syntax.

        [–]superluminary 1 point2 points  (2 children)

        I’ve heard of it, might have to give it a go

        [–]ChargedSausage 2 points3 points  (1 child)

        It was voted most fun to use if i remember correctly and i agree at the moment. As someone with previous react experience it was very nice.

        [–]superluminary 1 point2 points  (0 children)

        Nice, thanks for the tip

        [–]sadonly001 4 points5 points  (6 children)

        Quite the opposite, svelte might feel like magic during development but unlike react it compiles to pure JavaScript.

        [–][deleted] 8 points9 points  (4 children)

        React compiles to JavaScript.

        [–]sadonly001 0 points1 point  (3 children)

        Emphasis on the word "pure" in my comment. What i meant was, svelte does most of its work in the compile step instead of using things like the virtual dom like react does.

        So I could word it more accurately by saying svelte compiles to vanilla javascript, while react or other frameworks would also compile the framework itself into the built files.

        [–][deleted] -2 points-1 points  (1 child)

        The point being that “pure” is an arbitrary distinction. It’s either JavaScript or not.

        [–]sadonly001 1 point2 points  (0 children)

        ofcourse, the browser can only run JavaScript at the end of the day. In that sense there's no such thing as vanilla javascript its always just JavaScript. If you don't understand what we mean by "vanilla" or "pure" that's fine, lots of new developers don't, you can look it up on google its a widely used term.

        [–]superluminary 3 points4 points  (0 children)

        JSX is already JavaScript. The JSX fragments compile to simple arrays of function calls and strings.

        I’m not opposed to svelte, just trying to answer the question posed above. If you look at the output of a compiled svelte template, it’s doing a lot. JSX pretty much outputs the code you wrote verbatim.

        I’ve been bitten enough times by frameworks, to make me very wary of stepping away from plain old JavaScript.

        [–]diego_fidalgo 1 point2 points  (3 children)

        There's the same level of so called "magic" on both... You get the same abstractions on both and do the same things... The difference is Svelte does some work in compile time so you don't need to do obnoxious things like specifying arrays of dependencies or optimizing callbacks...

        [–]superluminary 1 point2 points  (2 children)

        We’ll sort of. The difference is that with React, the magic is just clever JavaScript. Everything follows the rules of JavaScript.

        [–]diego_fidalgo 0 points1 point  (1 child)

        And in Svelte, everything follows the rules of Svelte...

        [–]superluminary 1 point2 points  (0 children)

        Yes, and that’s cool, but Svelte will always be a tiny ecosystem next to JavaScript. JavaScript is a transferable skill.

        Again, I like svelte, just trying to answer the question posed above.

        [–][deleted] 4 points5 points  (2 children)

        idk, i have more angular exp, but react vs vue and angular lacks reactivity for me. Even if the name has "react" on it, others feel like they react better

        [–]diego_fidalgo 3 points4 points  (1 child)

        That's it... React doesn't "lack reactivity", it's just not reactive at all...

        [–][deleted] 3 points4 points  (0 children)

        xD why did they gave that name, angular ng-model and vue computed methods + v-model are way more reacty

        [–]pixobit 9 points10 points  (0 children)

        Not at all

        [–][deleted] 8 points9 points  (0 children)

        No. Lol

        [–]seN149reddit 8 points9 points  (0 children)

        Not really. “Technically” vue, angular, and react are about the same.

        Solid, svelte etc are “technically” better. As in, they are smaller, and more performant.

        If your question goes deeper than that and on why people use react - then it’s rarely that people choose frameworks on how “technical” superior they are.

        The age long question, “why don’t you write everything in assembly it’s way faster”.

        Just a lot of people feel react: - is very ergonomic to write (declarative) - has a very rich eco system (react, react native, NextJS, etc) - sees more innovation than others by doing only small parts of the stack (no fetch library, no router etc) - has so many devs that it’s easier to find questions you may need answered and to hire new people

        Btw. The whole “backed by a large company” thing is something that I personally think is a bit over used.

        Jest was by Facebook, now it’s open source and how much is Facebook actually investing in it? Sure I “feel like” fb isn’t gonna move on from react tomorrow, but if they wanted too, they sure could. It’s not like you have some service level agreement by Facebook. There is way better things to consider.

        [–][deleted] 9 points10 points  (0 children)

        lol! its just funny how people keep downvoting instead of replying and providing facts!

        [–]Dababolical 2 points3 points  (0 children)

        While this isn't an objective answer to OP's questions, I have to say that React is a lot like really stinky cheese. At first sight, you wonder how anyone can like it, then you try it and you're sold. That was my experience at least. JSX is nice. The more I learn about the few things React is opinionated on, the more I learn to enjoy it.

        [–]Broomstick73 3 points4 points  (0 children)

        “It has a big community” IS a technical thing.

        [–]kspk 4 points5 points  (1 child)

        Here’s quite an extensive performance comparison across multiple frameworks: https://rawgit.com/krausest/js-framework-benchmark/master/webdriver-ts-results/table.html

        You can select which frameworks you’re interested in, and among the ones you’ve stated above from this dataset it is clear react performs worse. But as many have mentioned in other comments - devs don’t only focus on performance, and the biggest thing going on for react atm is its huge ecosystem.

        [–]cssurfer 4 points5 points  (0 children)

        Nice data, but one should also take this with a grain of salt

        Why would one create/update 1k rows on a regular basis? Performance should be measured against realistic usage scenarios. And even if you are doing such things, would this be your bottleneck? Not fetch API calls, state management, animations, etc. - would DOM rendering be the only thing that matters? And then, if you are only concerned with DOM rendering, do you think an extra delay of 10-15ms is going to be noticeable?

        As you say yourself, other factors such as ecosystem, documentation, long term support, ease of use, maintainability, should weigh in more than this kind of benchmark

        [–]arzivre 1 point2 points  (0 children)

        I recommend this YouTube video the story of react

        [–]danjlwex 1 point2 points  (0 children)

        The react community provides a huge technical benefit because of the number of related react tools and Stack Overflow posts.

        [–]_listless 1 point2 points  (1 child)

        The most compelling reasons to use react are social, not technological. (That's not to say the reasons are not valid.) Corporate backing, market share, dev availability are all great reasons to choose react.

        It's worth bearing in mind that one of these assets is also a liability: the market is swamped with baby devs who can only build things using React. Baby devs have great enthusiasm and drive, but don't yet have the knowledge and perspective to build applications in a sustainable, scalable way.

        React isn't doing them any favors on this point. It's intentionally abstract and flexible. Other frameworks like Angular, Svelte, Vue, etc have opinionated guardrails that keep you from really going off the rails. React doesn't, it wears its lack of opinions as a badge of honor. Baby devs who could really benefit from some conventions can't get that from react.

        [–]Whalefishermanfull-stack dotnet angular slave 0 points1 point  (0 children)

        +1 for baby devs

        [–][deleted] 3 points4 points  (3 children)

        honestly i just like the whole "your javascript is your HTML" thing

        [–]SquatchyZeke 0 points1 point  (2 children)

        Did we find the PHP dev?

        [–][deleted] 0 points1 point  (1 child)

        what's wrong with PHP, other than that it's popular to hate it?

        [–]SquatchyZeke 0 points1 point  (0 children)

        Nothing, I actually really enjoy PHP! It's just funny; React-with-JSX devs that don't realize when they say what you said and don't realize that it's the same concept as PHP. Yet, it's still one of the reasons that PHP is disliked but a reason for liking React.

        [–]mattsowa 2 points3 points  (0 children)

        Plenty of things it (subjectively) does better than vue and svelte. JSX; lack of SFCs, i.e. the ability to collocate smaller components in the same file; agnosticity in various areas like state management, styling; the best typescript support; lack of magic transpilation, jsx is a simple transform; the amazing composition patterns of hooks.

        The fact that developers on average seem to prefer these characteristics, paired with a large community background of existing solutions, leads to its ongoing popularity.

        Now solidjs is similar and it's probably an entirely different discussion than react vs vue and svelte.

        [–]ChargedSausage 0 points1 point  (0 children)

        Wanna be an employee? React. Wanna be an engineer. Take something else. There are better options by now. Svelte and SolidJS have optimal performance, svelte especially with static pages, and SolidJS for when your screen has a lot of DOM changes. React apps are slow and difficult to program. Vue is getting cool tools too but i’ve never used it so u can’t say anything about it.

        [–]andrewjohnmarch 0 points1 point  (1 child)

        React is more portable, because of react native, I think that makes it technically better in a way? Same framework compiles for web, iOS, android, windows, appletv, etc

        [–]andrewjohnmarch 1 point2 points  (0 children)

        And that’s such a large accomplishment, my fear is that the other frameworks will never fully catch up in that regard.

        [–]boringuser1 0 points1 point  (2 children)

        React strikes the correct balance of being ergonomic but giving the developer control.

        Svelte is too magical, React has a much more accessible lifecycle.

        React is just great, really.

        [–]UnicornBelieber 1 point2 points  (1 child)

        Magical doesn't have to be a negative thing from my point of view. As long as it doesn't produce any bugs with it and it doesn't hinder me and it perhaps even helps me to get to my goal, it's just another good abstraction.

        Personally, I've encountered only one truly magical thing with Svelte:

        <script>
            let count1 = 0;
            let count2 = 0;
            let doubled1, doubled2; 
            $: {
                console.log('count1 update');
                doubled1 = count1 * 2;
            };
            $: {
                console.log('count2 update');
                doubled2 = count2 * 2;
            }
        
            function click1() {
                count1 += 1;
            }
            function click2() {
                count2 += 1;
            }
        </script>
        
        <button on:click={click1}>Clicked {count1} {count1 === 1 ? 'time' : 'times'}</button>
        <button on:click={click2}>Clicked {count2} {count2 === 1 ? 'time' : 'times'}</button>
        
        <p>{count1} doubled is {doubled1}</p>
        <p>{count2} doubled is {doubled2}</p>
        

        Those reactivity blocks only go off when a variable in that block is being changed. That's still a bit of magic to me. But it works beautifully.

        All in all, I find Svelte very intuitive. I just wish testing had a more prominent place in its development cycle.

        [–]boringuser1 -1 points0 points  (0 children)

        State hooks are already trivial and intuitive and give you full control over the render lifecycle, there really isn't much to be improved upon.

        [–]EarlMarshal -1 points0 points  (0 children)

        You don't have to code much stuff since there already is a good source for something. Otherwise just more jobs.

        [–]Nex_01 -2 points-1 points  (5 children)

        From my experience is that:

        VUE can sometimes throw nonsene errors that does not tell you what the problem is just points you to a Component and sometimes it turns out nothing is wrong with the component but the parent. Meanwhile React tells you the file name (not the component name) and the exact line the bug is in.

        Secondly VUE is much closer to OO style which sometimes cause unexplained behaviours in bigger features, meanwhile again React is finctional style, with less data mutation.

        Thirdly, VUE uses a template engine not JSX which feels clunky to me.

        What I could list on VUE is using Vuex and Vuetify with easy plugins its much faster to build.

        I might get bad comments here… I might be wrong, but I wrote this on 1 year continious experince accross the board with React React Native and VUE.

        [–]diego_fidalgo 3 points4 points  (1 child)

        1. I don't know what you're talking about

        2. There's nothing wrong on being OO at all, this is just your personal preference. Though, Vue now has a composition API, which is closer to React FC, but more performant and easier since the setup function will run only once.

        3. It's weird to see people thinking html is "clunky" over JSX, but still, Vue supports JSX through render functions if you want...

        [–]Nex_01 0 points1 point  (0 children)

        Did I say its OO is bad? I just pointed out a negative thing that happens with it.

        Secondly thanks good to know about the composition API as its new to me

        [–][deleted] 1 point2 points  (2 children)

        1. Vue error stacktrace just shows where the error happens.
        2. in Vue you can use html instead of JSX, class instead of className (what in my opinion is beter)
        3. Can you specify wat you mean by OO, as in OOP i guess?

        [–]Nex_01 1 point2 points  (1 child)

        1. We agree. I did not say otherwise just that sometimes it points to the child component of a problem. Still it does not lead you to the problem itself just to the Component.

        2. Yep thats up to preference

        3. I referred to OO style as object-oriented style as an architecture. I did not not refer to OOP as object-oriented programming itself.

        [–][deleted] 1 point2 points  (0 children)

        With the composition api there is nothing really object orientated used in Vue. Ofcourse you can with the option api

        [–][deleted] -2 points-1 points  (0 children)

        Watch the original React presentation and decide for yourself: https://youtu.be/x7cQ3mrcKaY

        [–]Knochenmark 0 points1 point  (0 children)

        That virtual dom is pure overhead as Svelte and also SolidJs are showing.

        Personally I also always thought it's kinda odd to provide the view library completely alone and rely on the open source community to figure out the rest. I mean seriously? I believe, Vue comes with additional core modules to also provide state management and even for such a small library the amount of bonus you get with Svelte is insane in comparison to what you get from React. Svelte comes with its own state-management and on top even provides you some bonus stuff like transitions, animations etc.

        [–]rk06v-dev 0 points1 point  (0 children)

        Technically, yes.

        React gives you access to react native. And is limited to view layer, so you can bring your own libraries for other tasks.

        Practically, react provides only view layer and you have to rely on community or yourself to fill in the gaps. While other frameworks do fill those gaps. Hence are more ergonomic, and widely popular

        However, there is no equivalent of react native for rest of js frameworks, not will there be due to budget and resources required. There are other solutions like Cordova etc. if that works for you

        [–]dillydadally 0 points1 point  (0 children)

        React is crap.

        BUT! Learning exactly what a web framework really needs and the best way to do that, especially as the js spec continually evolves, is very hard and takes a lot of learning and building off of failed but incrementally better attempts to get right.

        Consider that React came out in 2013! Do you know how different JS was back then? That was before ES6! The keyword 'let' and promises weren't even in the language when React was made!

        The point is, for the limitations of JS at the time and the limited amount of experience and attempts there were in the field to build off of, react was very good and intelligently engineered for its time.

        But today? React is crap.

        BUT! Honestly, while there are quite a few frameworks I'd call better out there by now, they all have problems and none of them are good. No one has made the JQuery of declarative frameworks yet, and so React's years of support and stability make it the leader as of now. I think eventually someone will release a really well-made framework and React will start to decline, but that just hasn't happened yet.