News for hackers. Stuff that matters.
Re:Comparing Svelte and React by alfonsodev on Wednesday March 24, 2021 @06:30PM (#26573857)
I think many people adopted React because Facebook was behind it, and using it in production, the ecosystem is huge, there is a react- package for everything you can image, there is also react-native, I don't like it, but there it is, you can reuse the knowledge to build native mobile apps.

Now Svelte, I haven't been following, but I think the creators are working in what's going to be next and even better framework[1], to your point of things in Svelte not changing as much as in React, maybe it just a matter of time. Here is the video I had in my bookmarks for a while, I still couldn't make the time to watch, so I hope my comment is not too far from reality.

[1]https://www.youtube.com/watch?v=qSfdtmcZ4d0&t=875s

Re:Comparing Svelte and React by hombre_fatal on Thursday March 25, 2021 @12:57AM (#26576747)
It's so boringly cynical to suggest that people use something because they're lemmings rather than any of the great reasons to use something.

Go watch the original React debut talk and ask yourself if React had/has anything going for it beyond Facebook's backing. I know I, and most developers I know, dropped Backbone/Knockout/whatever instantly to use React because it was so obviously better.

Now that unidirectional flow is the state of the art, the difference between the main frameworks just isn't that big. You gain a few things here, lose a few things there, and write a solution that is similar to what you would have written with the other frameworks.

Re:Comparing Svelte and React by preommr on Thursday March 25, 2021 @02:23AM (#26577078)
> I know I, and most developers I know, dropped Backbone/Knockout/whatever instantly to use React because it was so obviously better.

You skipped a huge step. There was angular before react. Which was horribly bloated and over complicated. People wanted something simpler. React, with it's facebook clout won in the end.

Re:Comparing Svelte and React by progx on Thursday March 25, 2021 @05:44AM (#26578130)
Something simpler: Vue

Something more simpler: Svelte

Just try it and give it a chance.

Re:Comparing Svelte and React by ricardobeat on Thursday March 25, 2021 @05:44AM (#26578134)
Both the uni-directional data flow and virtual dom were not exactly new ideas when React/Flow came out. There were other libraries/frameworks playing with similar concepts at the time. Half a dozen new ones appeared in 2014. React won the lion's share of developer adoption.

I personally heard that 'objectively better' line incessantly from 2015 onwards, with 'it has the largest community' always being a top highlight. Facebook's backing and the celebrities that developed in the JS community around the time certainly played a part in it.

Re:Comparing Svelte and React by AlchemistCamp on Thursday March 25, 2021 @05:53AM (#26578201)
I went to one of FB's early internal meetups about React and I was initially skeptical of JSX but very excited by what it offered.

I was working at Groupon and using Backbone at the time and found nesting components to be a major hassle. We used a framework called Thorax on top of Backbone, which helped but still fell far short of React's convenience.

Re:Comparing Svelte and React by alfonsodev on Thursday March 25, 2021 @06:45AM (#26578546)
> to suggest that people use something because they're lemmings

That's not what I intended to say, of course that's not the only reason people choose React, but I think they are valid reasons to help you decide.

For example let's say two libraries are technically different but equivalent productive and nifty, choosing the one that has a bigger ecosystem is a totally valid choice.

Many people had to sell React to their bosses, and the fact that there was a presentation by Facebook, helped a lot, I don't see how stating the obvious is calling lemmings to anyone.

At the end of the day, it depends on your goals and motivations, I can't talk for everyone, I was actually saying some of the reasons that helped me decide on choosing React.

Re:Comparing Svelte and React by dan-robertson on Wednesday March 24, 2021 @08:04PM (#26574767)
I don’t think any of your arguments in favour of react are sufficient. JQuery had a huge number of libraries and could be used to make websites that worked. Angular was backed by Google who generally have more clout than Facebook. I think most comparisons would find that jQuery does not solve the same problems and that angular resembles the kind of steaming brown thing one might find behind a cow—and that’s before you consider backwards compatibility.

I would argue that react has some particular merits (for three the whole vdom based architecture, using jsx, and unidirectional data flow), that it was the first (widely known) framework with those merits, and that it has generally been backwards compatible or only required simple changes. I think these do a better job of explaining why react became popular and inertia explains why it is still popular.

Re:Comparing Svelte and React by nawgz on Wednesday March 24, 2021 @08:31PM (#26575018)
Your counter points don’t check out too much though?

> jQuery

Just not possible to compose, which makes full applications difficult. No answers for state management or such either, completely a different scope than frameworks

> Google more clout than FB

In some domains sure, but I’ve never understood how people don’t think FB are masters of UI. There is probably no org with more UI clout than FB, they built their own insanely adopted library after all while Google can barely force their own engineers to use Angular

React is also unquestionably the most JavaScript of the libraries, a component’s markup is such a thin abstraction around an object and maps perfectly to DOM trees and concepts, classes or functions or hooks are all using native JS concepts, explicitly typed typescript and react genuinely eliminates the need for all simple testing plus makes for a streamlined developer experience, and its concepts of lifecycles and composability introduce complexity but in my opinion in a clearly delineated and extremely powerful way

Also, as always I have to note this, the churn argument is completely overblown wrt React, each way of writing code still works or compiles, conceptually the lifecycle and state management never changed just its syntax, and npm has old versions for a reason. I run 2016 code in production today as an internal application for engineers, and I’ve seamlessly updated webpack and module versions while keeping the same code syntax.

Re:Comparing Svelte and React by axguscbklp on Wednesday March 24, 2021 @10:34PM (#26575926)
Oddly, despite the immense resources that Facebook has available, Facebook in a browser is slow and glitchy, especially after the most recent redesign.
Re:Comparing Svelte and React by nawgz on Thursday March 25, 2021 @12:09PM (#26582016)
I can't say I share that experience at all - I make quite an effort to avoid installing their invasive apps, always using the browser - but it's an interesting point
Re:Comparing Svelte and React by dzonga on Thursday March 25, 2021 @03:36PM (#26584449)
writing react apps in a proper way is hard, very hard. plenty of companies out there big and small can't do it. once you've a professional react dev, you easily recognize the react apps due to the subtle bugs. makes me miss my old team, where our big react app was actually performant.
Re:Comparing Svelte and React by nawgz on Thursday March 25, 2021 @05:28PM (#26585632)
Can you speak to these bugs? I personally don't agree that React apps impart any standard class of bugs, but maybe that's because Redux is actually the source of all these issues and I've avoided redux like the plague it is
Re:Comparing Svelte and React by dzonga on Wednesday March 31, 2021 @08:21AM (#26646257)
example app: airbnb when you get messages. click a message. and you'll see it will still have an indicator that you've a message, when you've none. airbnb guys are some of the best react guys out there even released open source libraries like enyzme etc. fact is no one can ever get the react thing right. don't get me started on facebook. plenty of bugs in their new app. But for some reason, instagram web is polished.
Re:Comparing Svelte and React by dzonga on Wednesday March 31, 2021 @08:22AM (#26646271)
nice point on pointing out the redux part. yeah most times it's the point of bugs - state mismatch etc.
Re:Comparing Svelte and React by danjac on Friday March 26, 2021 @09:04AM (#26591623)
If a framework/library is very hard to use correctly - even for people who are not only experts, but contributors - then that's a huge red flag against it.
Re:Comparing Svelte and React by nawgz on Saturday March 27, 2021 @05:06PM (#26605632)
Sure, but if massive amounts of people disagree with that take and think the library is strong, intuitive, and best-in-class, maybe someone is just struggling with understanding the structure of the library
Re:Comparing Svelte and React by alfonsodev on Wednesday March 24, 2021 @08:44PM (#26575142)
> that it was the first (widely known) framework with those merits

Yep, and my interpretation is that, that (the widely known part) happened because it was backed by Instagram first (if I recall correctly) and then Facebook.

And not to invalidate your point but to add another speculation on why React became more popular...

Yes, Angular was backed by Google, but not used in production in massively successful product as Facebook, or Instagram, and I remember also about writing Directives, Services and it wasn't very inviting for third party packages.

When react came out, I remember the selling point was "it's not a framework, it's a library", "it's the V of MVC" and I think that strategy also helped to let the community create all the other pieces, and long term have a richer ecosystem.

Re:Comparing Svelte and React by deepstack on Thursday March 25, 2021 @02:57AM (#26577208)
The main reason people started using React is the JSX implementation in React at the time was very innovative. Actually many people working with Rihno in 2006 has talked about using JSX as templating system. FB is just the first one did it. However, now days there are plenty other less bloated front end frame work such as svelte, vue, mithrill that is more easy to use and have JSX support as well. There is really no reason to use React now days.
Re:Comparing Svelte and React by hajile on Thursday March 25, 2021 @12:59PM (#26582638)
It took a month to teach angular and a year to become proficient. Knockout or backbone + handlebars were similarly large commitments. React took a day or two to learn and less than a a month to completely master.

I also hear about “react doesn’t have one way of doing thing’s built in”, but it wouldn’t have been as successful if it had. It ate up other frameworks because it was so easy to integrate.

Need more performance in your angular app? Just add an ng-react component. Have an extensive backbone project? You can just gradually swap in react to replace your mustache templates and leave backbone alone. Have a jQuery widget that’s getting hard to maintain? Change to React and the rest of the page renders on the server like it always did.

And of course, you could greenfield with flux, rxJS, or whatever other thing worked for your company. But if they hadn’t been flexible from the start, there wouldn’t have been room to create and test things like reactive programming, redux, mobx , etc