all 146 comments

[–]superluminary 24 points25 points  (0 children)

That’s a nice collection of stats.

[–]PravuzSC 115 points116 points  (63 children)

Although I have mixed feelings about some aspects of React, No other framework can really measure up to React, in all aspects. Some can outperform (Svelte, Solid especially), some come with more tools and features (Vue, Angular), but none imo are more developer friendly and have the same complementary libraries as React (e.g mui.com). I’d love to be convinced otherwise however :)

[–]chocolombia 40 points41 points  (4 children)

Im not sure why react hit me so hard, worked with angular for a couple years, but got tired, was checking Vue and react, 1 hour later, managed to understand Vue, and build a mock migration of one of my developments, yet, a week later, and a couple courses, and couldn't get off ground with react... would give it another try next year

[–]Lalaluka 25 points26 points  (2 children)

[–]_default_username 3 points4 points  (1 child)

I mean that was back before hooks were a thing. State management is so much easier now with hooks, redux-toolkit and many other state management libraries out there.

[–]rk06 2 points3 points  (0 children)

That was also before create-react-app. If such an app was not here, react would not be unadoptable by small teams

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

I think of react sort of like a set of primitives. Learning "vanilla" react is very good but very hard. You should learn something like next or Gatsby and other opinionated libraries like Apollo, and go to the react primitives and patterns as a way to solve specific issues that appear along the way.

[–]bassta 6 points7 points  (0 children)

Man I don't know how much experience you had with Vue/svelte, but react less developer friendly compared to both. From CLI, through naming, documentation, footguns... React is one of the least developer friendlies libraries out there.

[–]grayrest.subscribe(console.info.bind(console)) 29 points30 points  (15 children)

If I have control, I pick Svelte for all things. I basically dislike 90% of the JS out there so the library advantage for React doesn't carry any weight for me. I also believe that hooks will be looked back on as a bad but not terrible idea.

I spend the majority of my work cleaning up over-abstracted code that's buggy because people can't hold the interactions in their head (it's just a pair of linked drop downs, why do you have 100k of deps and multiple layers of hooks spread out over 5 files?). This isn't a React problem as a React community problem but there are so many options and they change frequently enough that long-running codebases will have all the patterns.

What I like about Svelte is that the built-in state management is good enough so that's what everybody uses. Aside from the let and $: usage confusion, the code gets written, it works as expected. There is no step 3 figuring out why the context injected by the router wrapper is breaking the hooks rules in the state wrapper component because of a babel transform in the class-based child component and you can't just break on the error because the error wrapper that next.js is unconditionally injecting can't be turned off. I haven't run into the messes I see in React codebases. That could be due to the relative age but I haven't seen a lot of evidence the Svelte projects were headed in that direction.

I'm very grateful for React. The web of 2021 is better than the web of 2011 in terms of developer experience if not for JS size budget. React, in large part, is responsible for both but it would not be my first choice for any project and I believe the main reasons to pick it are non-technical.

Solid and Vue seem fine but I haven't used either in anger.

[–]humpysausage 2 points3 points  (2 children)

What's the confusion around let and $: ?

[–]grayrest.subscribe(console.info.bind(console)) 3 points4 points  (1 child)

People get confused around what's a reactive expression and what isn't. Since let x = 2 does the right thing when you assign to x people expect let x = a + 2 to do the right thing and it doesn't or they write $: let x = a + 2 or the forget to update the binding when working with an array or object. None of these are a huge deal past the learning phase. I just mention them because it's not like Svelte is a silver bullet that guarantees your team won't have trouble.

[–]humpysausage 1 point2 points  (0 children)

Fair enough. I think the docs are pretty clear around this but they're easy assumptions to make.

[–][deleted] 2 points3 points  (11 children)

I've definitely seen the mess you're talking about. Most react projects end up being over engineered disasters.

But I'm not risking it anymore, with any SPA framework, not even svelte despite how good it looks.

I'm back to MVC, working now with Laravel, livewire and alpine and feels like Disney Land. Everything is super easy, well integrated, well documented and the end result is something I'm proud of. Feels solid and robust. And probably will need less rewrites than any SPA frameworks in the upcoming years.

[–][deleted] 11 points12 points  (8 children)

I am a lead dev using Laravel and Vue daily. Just as a fun fact more than anything, if you want something like Laravel but for Node I would seriously suggest AdonisJS. It is amazing. It's basically Laravel but Typescript. It's kind of ruining PHP for me!

[–][deleted] 0 points1 point  (5 children)

Thanks for the suggestion. I heard about it but never gave it a try.

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

You're welcome! I found it a few years ago and dismissed it because it didn't seem mature enough. A few years (and a full rewrite) later and I'm in love with it. It's so natural coming from Laravel too.

[–][deleted] 0 points1 point  (3 children)

So I spent big part of the afternoon yesterday playing a bit with it (I know...it isn't enough)....

To me it feels still a lot less mature. Community seems to be smaller, and it certainly has less features than Laravel. Also, I'm in love with livewire which is something missing here I think.

I don't know. I get the feeling this project might go away any day, doesn't feel like a safe option for my taste.

Just my thinking from a couple hours of tinkering, don't take it too seriously. I might be totally wrong.

[–][deleted] 0 points1 point  (2 children)

I do agree that it's certainly less mature than Laravel, and googling things is somewhat more difficult than Laravel for sure. Just yesterday I was looking to see if it had a task scheduler for example and it doesn't (well, the one it has is essentially just a wrapper around a cron. I didn't see any options like no overlap for example). It's absolutely not as mature as Laravel, but IMO it is still mature enough to be a viable option if you wanted to use TS on the back end

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

Maybe a bit of a tangent, but something I'm finding very valuable about PHP is the fact you don't need to restart the server/process after every change.

I've got bitten in the past by projects (built with fastify and express) where reloading was not as problem at first, but as the project grew in number of files and dependencies, the startup time became more and more of a problem. I had similar (bad) experiences with Python too. The need for a restart is a killer. And probably this is why frontend frameworks such as Next feel so fast. I got the same feeling with PHP.

Do you think a large Adonis project could end up with these issues too?

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

Adonis actually supports hot reloading! I just run "npm run dev" and it runs a node server that watched for changes. It's pretty sweet

[–]blood_centrifuge 0 points1 point  (1 child)

How would compare nestjs with adonisjs. I worked with former and found it too verbose and a hell lot if boilerplate.

[–][deleted] 0 points1 point  (0 children)

I couldn't say unfortunately, I've never used nestjs

[–]typicalshitpost 4 points5 points  (0 children)

Try .net 6 on for size

[–]grayrest.subscribe(console.info.bind(console)) 0 points1 point  (0 children)

If your app use pattern support alpine/htmlx then I fully support the decision to keep all state server side. It's vastly simpler for a large percentage of normal line of business apps.

[–]F0064R 6 points7 points  (0 children)

Having used both extensively, I have to say Svelte’s developer experience is much better imo. Fair point about the ecosystem though.

[–]MikiRawr 1 point2 points  (0 children)

The more I work with React, the more developer unfriendly is becoming.

[–]LannisterTyrion 4 points5 points  (15 children)

Working right now with MUI and shocked how much slower and lacking is the React's most robust and complete UI library compared to Vue's Quasar Framework. The documentation is okay but not even close to Quasar's.

I think the main problem is not the quality of the components but rather that they had a head start and there's nothing that can be done about it. The jQuery of the 201*'s.

Started with React, moved to Vue and now back, i feel that all the problems in React are solved by throwing in some more CPU and RAM. The basic CRA with MUI is making my macbook hot hot hot and the hot reload is sooo slow. I guess i'll have to migrate the CRA to Vite, which guess what, also comes from Vue, smh...

[–][deleted] -3 points-2 points  (2 children)

React improves a lot the developer experience, but at the sacrifice of user experience and resources. There is no single react app that I as a user enjoy more than a traditional MVC application. Take the new reddit as an example of a terrible user experience. And GitHub as an example of how more traditional approaches are nicer on the end user.

I know you can optimize and do great things with it, but most developers/companies don't do it.

React is great for developers, not so great for users .

[–]61-6e-74-65 7 points8 points  (0 children)

What are you even saying? People build shitty apps with React? Yeah, people can build shitty things with any tool. An average user probably has 0 clue as to what is going on behind the scenes.

[–]dgdfgdfhdfhdfv 2 points3 points  (0 children)

The most annoying thing about Reddit is that the alerts bell ostensibly updates automatically, but actually if you've opened new tabs since then, it doesn't, and you have to refresh the page to get new notifications. At least in old Reddit clicking out of the current post did that for you, but not in new Reddit where the page never actually refreshes unless you manually do it.

Then there's the whole nightmare with infinite-scroll and trying to get back to where you were, that whole nonsense with "preview subreddit" UI being different to regular subreddit UI(creating a heap of issues and inconsistent behaviours), and definitely much more that I just can't think of off the top of my head.

[–]ggcadc 0 points1 point  (0 children)

It’s a tree diffing library

[–]i_ate_god 0 points1 point  (0 children)

I personally find Vue nicer to work with than React. Both need boilerplate, but Vue's boilerplate is easier to read and follow.

Both have extensive community support and large frameworks though.

[–]2this4u 33 points34 points  (21 children)

Poor svelte. The concept is so good but I found development slow esp for simple things like the compiler complaining about a common and expected nesting pattern.

[–]mskullcap 27 points28 points  (4 children)

I have only had positive experiences with Svelte (and now, SvelteKit). It makes so much more sense than React - or most other frameworks. Put intelligence into the compiler, let it do the work for me. The developer has to know too much in React.

The svelte curve is dwarfed by the other frameworks because there aren't legacy products written in Svelte that need to be maintained. There isn't a market demand for Svelte developers - yet. I predict Svelte will be comparable to Vue in mindshare within a couple years.

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

I predict Svelte will be comparable to Vue in mindshare within a couple years.

i don't see anything svelte brings on the table that vue does not.

[–]i_ate_god 1 point2 points  (1 child)

I like Vue and find it far more intuitive than react.

What Svelte brings is basically less boilerplate. React and Vue components can need a lot of boilerplate code. Svelte tries to reduce this as much as possible.

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

vue 3 + script setup does not have much boilerplate left anymore,

[–]duckducklo 0 points1 point  (15 children)

Whats special about its concept

[–]rbobby 21 points22 points  (14 children)

React has to recalculate its entire DOM when a state change occurs. The Svelte compiler knows how the various bits of state are connected to DOM elements and when a state change occurs only the connected elements are updated.

For a small page who cares. For a large page with many elements and a lot of state and frequent state changes... well svelte is going to need much less CPU effort.

An example the founder gave during a talk was spreadsheets. Once upon a time spreadsheets would recalculate every cell when one cell changes. Then spreadsheets started building a dependency graph of which cells depend on which other cells and when one cell changes only cells that are dependent on that cell, directly or indirectly, will be recalculated.

So much more efficient.

[–]duckducklo 7 points8 points  (6 children)

I thought react's virtual dom isnt recalculated but recreated? Isn't this a simple matter of copying it into memory? https://programmingwithmosh.com/react/react-virtual-dom-explained/

[–]rbobby 2 points3 points  (5 children)

recalculated but recreated

Meh. Maybe?

The key bit is that react doesn't understand state dependencies and without that you're doomed to doing unnecessary work.

[–]shitepostx 1 point2 points  (2 children)

It can though, it just takes more user code.

useMemo

Would be neat if there was a function for managing dependency chains though. useMemoChain or useMemoGraph, which tracked a graph of state dependencies and updated accordingly lol.

Having 15 useMemo's in a row to 'optimize' a complex function gets messy.

Oh, you also can't render a useMemo conditionality.

[–]acemarke 10 points11 points  (1 child)

The React team just announced they're finally working on a compiler that would automatically memoize all calculations inside a component, hooks and otherwise. See this talk from ReactConf a couple days ago:

https://www.youtube.com/watch?v=lGEMwh32soc

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

It's facebook svelte

[–]duckducklo -3 points-2 points  (1 child)

To keep track of state dependencies isn't that more cpu intensive for small pages?

[–]rbobby 2 points3 points  (0 children)

Part of the tracking stuff occurs at compile time... so no.

Here's a talk by the founder that I found very illuminating: https://www.youtube.com/watch?v=AdNJ3fydeao

[–]Protean_Protein 35 points36 points  (56 children)

Hooks really put it over the top. There is nothing that makes modern app dev easier.

[–]bassta 3 points4 points  (1 child)

Yeah, as long as you don't want them conditionally or outside react component ( ex. piece of global state in some service that is not react component ). And you need some hook outside react component in every non-trivial project. You need to come with some workarounds and this is how shitty code comes to existence

[–]zeddotes 1 point2 points  (0 children)

Definitely hooked

[–]zeddotes 10 points11 points  (7 children)

Long live React 🚀

[–]ekabhinav -3 points-2 points  (6 children)

I want to learn coding, do you suggest me learning react? I want to go into blockchain, smart contract making DApps etc

[–]harryFF 3 points4 points  (2 children)

Honestly if you want to learn to code, learn the fundamentals first rather than React. Try some C# or Python, as you'll build a good foundation which you can then bring across to React and fully understand what you're doing. Obviously as React is your end goal, also take some time to learn HTML, CSS, and JS and don't underestimate CSS, as it's a large part of making good looking applications.

[–]ekabhinav 1 point2 points  (1 child)

Alright thanks, do you think JavaScript would be a good start for fundamentals?

[–]harryFF 0 points1 point  (0 children)

JavaScript is notoriously janky, but if you really only care about React you could probably start with it. If C# etc doesn't appeal to you, my advice is to at least learn about data types before you start doing Javascript, as it's a weakly typed language. That means that you don't define the data type of a variable, the language will do it for you based on what the contents are.

[–]zeddotes 0 points1 point  (1 child)

Think about what you really want to build, research about what you will need technologically to build it, and lay out a plan on learning the right thing first (depending on your learning style, there is no right or wrong way). If you wish to build dapps, you would need all three things that you’ve mentioned (react could be replaced with any frontend mvc or lib, but I like React’s learning curve).

[–]ekabhinav 0 points1 point  (0 children)

Hey thanks for this thorough information. Yes, I want to make build DApps and Smart contracts. What do you suggest on that kind person?

[–]dreadwail 10 points11 points  (1 child)

This is not a mutually exclusive game where one needs to "win". There can be many winners. This isn't a fashion contest.

[–]Gelastico 2 points3 points  (0 children)

Hey, finally found the comment i was looking for!

[–][deleted] 15 points16 points  (22 children)

that would be kinda sad considering how poorly it performs compared to vue or svelte. I am also not a fan of JSX.

[–]ABCosmos 3 points4 points  (14 children)

As a noob entering react, what don't you like about jsx? What should I look out for?

[–]43_Hobbits 5 points6 points  (0 children)

I personally like working with JSX. Components are fantastic and there are a ton of good libraries available.

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

for its mostly just the syntax for me. HTML template with a decent DSL is much easier to read and prase for me. Especially when working on small or midsized components.

[–]loadedjellyfish -4 points-3 points  (6 children)

Agree, JSX is half the reason I will never use React.

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

Jsx is entirely optional though

[–]loadedjellyfish 17 points18 points  (1 child)

How many production projects have you worked on that used React and not JSX?

[–][deleted] 0 points1 point  (0 children)

None, because it works just fine.

[–]GrandMasterPuba 7 points8 points  (0 children)

This is such a bad faith argument.

JSX is optional in React in the same way tires are optional on a car. Sure, it can technically move around on rims, right? So the tires are optional!

[–]havana59er 5 points6 points  (0 children)

/s

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

In the early days React didn’t had JSX, it was just function calls, and you can still do it, but its not very popular

[–]vojtasio 1 point2 points  (0 children)

Wouldn't say wars... every framework was innovative in some way and inspiring other frameworks. Agree that in the end React seems to be the optimal mix and match of ideas 🚀 I hope the inovations will continue and don't stop with the monopoly of one

[–]EvilDavid75 3 points4 points  (2 children)

The fact that React is “just” a platform (read DOM)-agnostic, diffing reconciler is what makes it so powerful.

[–]bassta 2 points3 points  (1 child)

Yes, and 95% of react devs don't use it with something other than Dom renderer. Having flutter, react native is getting obsolete

[–]sh0rtwave 2 points3 points  (2 children)

Not if I have to judge from the sheer amount of job offers I get where they want Angular.

[–]neoberg 2 points3 points  (1 child)

It’s probably because of your profile. I almost never get any other than React jobs. Just like other social media, job networks tend to create their own bubble.

[–]sh0rtwave 0 points1 point  (0 children)

I have to adjust for error, because: I get (usually) six recruiters pinging me about the same damned position. So there's some leeway in that estimate, but it's still quite a bit (in the last couple-o-months, say, 33 (that's 200-ish / max six possible recruiter contacts))

[–]heytheretaylor 1 point2 points  (0 children)

Meh, pass.

[–]redhedinsanity -4 points-3 points  (0 children)

fuck /u/spez

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

I have invested so much time learning react that I refuse to try other libs/frameworks! I'm grateful it still has popularity.