by johnfn · 4y ago · 0 comments
React isn't as fast as Svelte, but Svelte gets those gains by putting another compiler in your build pipeline, a tradeoff unacceptable to many.
React isn't as thin as Preact (or whatever other small library there is), but that means that React has more functionality.
React might not be as easy to learn as some other frameworks, but that's because, honestly, React chose the right abstractions to build, and those aren't always the easiest to understand. (Honestly, they aren't hard to understand either; it's a minor difference at most, but it is what it is.)
And honestly, if you were to build a big matrix of frameworks graded across all these categories, I suspect you'd find that leaders in one category almost invariably tank in other categories, for the exact reason that you have to make significant cutbacks in order to beat the tradeoffs that React made.
In programming language / library design, you can often "have your cake and eat it too" if you can find a better design. Better designs take years to invent and mature - jQuery came out in 2006. React came out in 2013 (7 years later) and I think it improved on jQuery in just about every way.
But now its 2022. Its been 9 years since React came out. As far as I can tell, clever folks have improved on how react works in just about every way in turn.
What deep tradeoffs are Solid or Svelte making in exchange for their speed? I can't spot any. As far as I can tell, React's virtual DOM diffing is pure overhead - so good riddance. Solid and Svelte use a different approach to deal with state (similar to React's hooks) that honestly I prefer anyway. Dealing with state in react is a mess.
Where do the new frameworks lose to React on any technical metric? Svelte is designed to be compiled, but lets be honest - in 2022 almost everyone is compiling our JS anyway.
Go ahead and build a matrix of frameworks if you want. The competition is fierce. Like jQuery before it, React hasn't aged well. I'd bet good money that react, like jQuery, doesn't come out on top.
jQuery has aged beautifully!
In case you or anyone else reading don’t realize it, jQuery aged so beautifully the APIs are now built into (or in many cases fixed/standardized in) every browser in C++.
Yes that means the downloadable version is no longer needed, but please keep in mind every time you use a selector (for those that don’t call them “selectors” anymore some basic examples: “#content” or “.dropdown”) in JavaScript, you’re “using jQuery”. Even the fetch API was roughly pioneered by jQuery’s Ajax helpers, and slightly refined and included in every modern browser.
To discredit jQuery for being redundant is exclusively a lack of knowing browser history.
For Svelte, the comment you replied to already said that:
> Svelte gets those gains by putting another compiler in your build pipeline, a tradeoff unacceptable to many.
To emphasise, this was also the reason why it took so long for it to get TypeScript support (and I'm still not sure if everything's properly typed now, which is a common problem with template-based languages, but let's assume it is).
Additionally, I think (but haven't worked with Svelte, so could be wrong) that Svelte is a lot harder to write unit tests for? As in, you can just use React's virtual DOM in Node without needing to spin up a browser. With a quick glance I don't see any references to testing in the Svelte docs.
Solid I'm less familiar with, but AFAIK its architecture requires you to put logic back into your templates again, with components like <For>, <Switch> and <Match>, presumably limiting what you can do. And I totally get that the advantages of Solid's architecture make that worth it, but usually, if you can't spot trade-offs in advance, the reason is that you'll run into them later, rather than that there aren't any. So I'm sure I'd find more if I were to actually work with either of these frameworks. And yet I might then still conclude that they're worth it!
Svelte has a whole host of similar and differing problems.
Personal opinion - I’d choose React today over the rest, as someone who built my own frameworks much like Svelte and Solid 5+ years ago.
The reality is that nobody cares what you use to make your webpage or app. It might take a while to dethrone python and react, but who cares? Make software using whatever tools you want. There's lots of jobs, and these things are super easy to learn anyway.
I'm convinced that half of the jobs listing React are using Svelte or Vue or something, but know they'll get more candidates applying if they hire for react and then just train the person in vue after they start.
Easy to convince yourself of this, but in reality what is the benefit of having to sift through even more applications and waste time to go through the processes just to say "oh by the way we don't use React, we actually use Vue, hope that's ok" and think that the candidate, expecting to be hired to do React will just be like "yeah sure no problem, I actually mastered all the frameworks so it's fine that you lied about what you use."
Fantasy land.
It’s kind of like webcomponents (separate concerns by component, not by language), I wish webcomponents had been part of one of the initial steps of HTML.
I wonder why so many folks care about performance. I guess it's the only objective thing you can throw in someone's face as an argument.
But I think one of the major benefits of Svelte is a better mental model for state management. It hides the right pieces of complexity, while both React and Solid throw them in your face.
Its been shown repeatedly that application performance dramatically moves the needle on retention, eg [1].
Personally I care about it because using slow software makes me feel like I'm ill. And developing slow software makes me feel like I'm bad at my job.
Your users have spent thousands of dollars buying hardware that can run billions of operations per second. They do that in order to run your software fast. (If they didn't care about performance, they'd be using old hardware.)
Your users didn't spend thousands of dollars buying super fast hardware just to get you off the hook for doing good engineering. Slow software is a sign of sloppy craftsmanship. I hate it.
[1] https://helda.helsinki.fi/bitstream/handle/10138/273640/Mast...
When I'm looking at Svelte or Vue I care about developer experience way more than their performance compared to React.
If performance mattered as much as you're claiming, React would never gain traction. After all, Virtual DOM is pure overhead.
Svelte is so much more than just faster.. It's reactive to the core!, you don't need redux stores or whatsoever, no react-hooks with all it's unacceptable traps and edge cases, no CRA where a simple eject shows the mess it actually is.. I can go on and on. Sorry but IMAO React is totally deprecated, it had its time, but there are much better solutions now.
Just take a few days to dive into Svelte (or even better svelte-kit) and I doubt you'll ever want to go back to the ever mounting complexity React has become.
I've been programming professionally in React from 2014. In the first years it was great compared to Angular, but today I cannot think of any reason to start a new project in React.
Svelte has now been around for, what, 4 or 5 years (according to Wikipedia)?
How bad are the breaking changes to larger apps that are built with it? When I google "svelte breaking changes", I get results such as https://svelte.dev/blog/whats-new-in-svelte-september-2022
Foundational churn that cause deep and broad downstream impact can really slow down a team. Generally, backwards and forwards compatibility is a plus in my view and a tradeoff against it is worth being intentional about.
Have you looked at the svelte compiler? It's not as small and easy to reason about as you want to think it is.
But everyone uses React with the JSX compiler? I mean it certainly is a strength of React that you _can_ use it as a plain old library, but it's not the common use case.
I think the root of the problem with react is actually the community. The web community has not figured out how to maintain software. There is an unhealthy attraction towards new paradigms and tools and an unhealthy willingness to endure paper cuts. So many practices simply wouldn't fly in any other community. Skepticism towards new ideas and a stubbornness to resist change are very important attributes for any community. It ensures that when a change does happen it passes through a very strict filter ensuring only the best of ideas get through. Tools that are built will only be as good as the community. I believe React had a great opportunity to become something cherished, but the community had to take it to that direction.
> There is an unhealthy attraction towards new paradigms and tools and an unhealthy willingness to endure paper cuts.
Web developers (who are often maligned on this site) are both too eager to move to better tools... But also, not eager enough
> So many practices simply wouldn't fly in any other community. Skepticism towards new ideas and a stubbornness to resist change are very important attributes for any community.
Yeah, and hooks had a lot of pushback at the time. The new useEffect semantics are getting pushback. These are exactly what you are asking for.
What are you wanting us webdevs to... _do_, exactly? It seems anyone can come to Reddit or the orange site and rail against UI programmers all day. But if we sit down and explain the situation nobody is very interested to listen.
On the topic, the latest kid on the block is deno. New runtime is cool, but having to rewrite userland is ludicrous. Now you have deno dotenv package, (inspired by node dotenv), oak middleware inspired by koa, semver, base64, a modern web framework... where's the end to this? Reinvent the entire node ecosystem and fragment the community?
Now I never blame the creators because they are attempting something, but if this takes off I will blame the community. People should be up with their arms shouting what a terrible idea this is, but that kind of critique is something that is missing from this community. One of the best things about the web community is their unconditional positivity, but that is also their failing. I fear people will jump on bandwagon and embrace deno with both arms, we will see a race to rewrite all the popular node packages in deno, companies will open positions for deno developers, new developers will be asking whether they should take the node course or the deno course, all until the next asteroid arrives.
And when someone tries to make things better with a new take or tool they get shat on here with “hurr durr those JavaScript developers always jumping on the new framework of the week”
HN, where sneering at web devs always gets upvotes and somehow never gets old
The problem is, how do you ensure that a "very strict filter" is also a good filter? The best stuff gets caught up in those filters, because the best stuff looks like nothing the filter has seen before. Or it might indeed look too much like something the filter has seen plenty of times before and (rightfully) dismissed as unimportant. And in the end it is not so much a community embracing the best idea, but the best idea taking a sledge hammer to the community.
I like React, and I think it is improving quite nicely. But Svelte seems also an interesting thing to try out.
This is absolutely true but 99% of React sites don't need the extra functionality if they've already accepted stopping supporting old browsers. Everyone who uses React should be testing Preact to see if their app works. It could well be a very low effort way to knock a few tens of KB off your bundle size.
React's functional components are a monument to concept over practicality, and the overall ecosystem is a hot mess.
Populating initial state should not be a difficult special case. Handling state changes should not be a choice of esoteric extras. These are just basic requirements of any reasonable application.
React got quite a bit right, and it seemed cool at the start, but at a certain point the enthusiasm for "concept" diverged from actual requirements.