Most active commenters
  • incrudible(3)
  • dotancohen(3)

←back to thread

Svelte 5 Released

(www.npmjs.com)
390 points begoon | 20 comments | | HN request time: 0.687s | source | bottom
Show context
levmiseri ◴[] No.41890499[source]
I can wholeheartedly recommend Svelte. As someone who can only do vanilla HTML/CSS/JS, it lets me build projects quickly and efficiently without having to learn something complex like React. Case in point this silly side project made in Svelte over a weekend: https://meoweler.com
replies(9): >>41890619 #>>41890752 #>>41891836 #>>41893235 #>>41893443 #>>41893762 #>>41893999 #>>41894401 #>>41900943 #
1. incrudible ◴[] No.41893762[source]
> vanilla HTML/CSS/JS

...but that's what Svelte is not. The techniques you adopt won't transfer over to vanilla HTML/CSS/JS without the magic Svelte compiler. These habits will become crutch when Svelte inevitably goes the way of every Javascript frontend framework.

> something complex like React

React is not that complex, certainly not more so than Svelte. It's hard to wrap your head around some behaviors, but at the end of the day, it is really just Javascript/Typescript. It is programming. As a programmer, I want to spend most of my time programming in a programming language, not so much of it configuring the Rube-Goldberg machine that is HTML/CSS. Your mileage may vary, of course.

> this silly side project made in Svelte over a weekend

I will admit, that's what Svelte excels at.

replies(5): >>41894007 #>>41894339 #>>41894461 #>>41894670 #>>41905186 #
2. lofaszvanitt ◴[] No.41894007[source]
It's a bloated, unnecessarily overcomplicated piece of trash.
replies(1): >>41894207 #
3. martpie ◴[] No.41894207[source]
That the whole industry embraced. Not bad for a piece of trash.
replies(2): >>41894452 #>>41896075 #
4. levmiseri ◴[] No.41894339[source]
I guess it's more that knowing only vanilla HTML/CSS/JS transfers really well to Svelte than the other way around.
5. throwawayie6 ◴[] No.41894452{3}[source]
As someone who had to work around the bugs and limitations of IE6 for years in the enterprise, popularity is not a measurement of how good a technology is.

The reason React is "embraced" by the industry is that it is widely used, not because it's the best choice. This lowers the risk for companies that can replace its developers with another easily. I'm not saying it's as bad as beeing stuck with a stale IE (yet), but there are surely good alternatives out there.

"Nobody has been fired for choosing IBM", was a saying that applies to React today

It has reached the "IBM" point where it's so widely used, that it has become the most rational choice for enterprise.

We have to wait for a few years while smaller businesses who don't have (or care about) the same risks uses better alternatives until they reach the point where you are not blamed for choosing something outside the box

replies(1): >>41894795 #
6. DecoySalamander ◴[] No.41894461[source]
> As a programmer, I want to spend most of my time programming in a programming language

If your work requires you to use a web stack, this attitude will not serve you well in the long run. If you make the effort to learn these technologies, you'll soon find them to be simple and predictable, but admittedly not without some historical baggage. You may even have an easier time with Svelte, since it has everything working out of the box, unlike React, which requires you to figure out a build toolchain and a separate solution for styling.

replies(3): >>41894676 #>>41894951 #>>41894993 #
7. dotancohen ◴[] No.41894670[source]
> It's hard to wrap your head around some behaviors

I've got a React maintenance and development project coming up in a few weeks. I'd love if you'd expand a bit on these points and maybe point to some relevant docs. You could potentially save me days or more of tail chasing. Thanks.

replies(2): >>41894973 #>>41896309 #
8. tcfhgj ◴[] No.41894676[source]
Having everything ootb is something I enjoyed a lot with Angular as well.

Interestingly, people chose React over Angular, because it gave you the freedom to not use anything.

9. spoiler ◴[] No.41894795{4}[source]
> The reason React is "embraced" by the industry is that it is widely used

That looks like tautology to me. What point are you trying to make with this?

Comparing IE6 and React is _hardly_ a fair comparison. One was a Trojan horse injected by corporate policies and ACLs, while React gets explicitly chosen by teams. And... Yes, there _is_ a reason why nobody gets fired for choosing React: it's not a bad choice! Is Svelte a better choice? Not universally. Unfortunately—like with many things in our field—it comes with trade offs and the answer boils down to "it depends" again.

React has its quirks, but "hating" on a library because it was part of a dumpster fire project doesn't mean the library is bad, just that people using it weren't competent with it (not necessarily incompetent in general).

Vue, Svelte, Leptos, Solid, Elm. I've seen all of them used as dumpster fire fuel, and it was hardly the library's fault.

replies(1): >>41899218 #
10. incrudible ◴[] No.41894951[source]
> If your work requires you to use a web stack, this attitude will not serve you well in the long run

I disagree. A "web stack" is outdated quickly, but the language remains mostly the same, as does my data. React lets me express most things naturally as forward data transformations, without entangling me too much to peculiar toolchain that will become obsolete and break absolutely everything.

> You may even have an easier time with Svelte, since it has everything working out of the box, unlike React, which requires you to figure out a build toolchain and a separate solution for styling.

Sure, you'll have an easier time making decisions if someone else makes them for you.

replies(1): >>41896477 #
11. incrudible ◴[] No.41894973[source]
Primarily the rules of hooks and what does and does not trigger a render or a unmount. If your project still uses class instead of function components, that's a potential target for refactoring.

> some relevant docs

Read the docs. All of them. React isn't that big.

replies(1): >>41895310 #
12. rapind ◴[] No.41894993[source]
Not sure about this. Most JS frameworks only last a few years before the next shiny is mass adopted. The churn in JS land is insane.

React is definitely one of the long beards though, and thats’s because declarative programming is a win for UIs IMO. So much so it had a massive knock on effect in popularizing this approach (what’s old is new again… and again) across languages and problem sets.

replies(1): >>41895792 #
13. dotancohen ◴[] No.41895310{3}[source]
Thank you. Neither of those topics are new to me. Great to know!
14. DecoySalamander ◴[] No.41895792{3}[source]
IMO we're long past the churn era - Svelte itself is 8 years old. There are occasional bursts of new frameworks and tools, but only when there is a new niche - the last one I remember was a few years ago when suddenly everyone wanted to do a static website generator. And that didn't make existing frameworks obsolete.

In my post I was actually speaking about learning CSS and HTML alongside the "real programming language" that is JS/TS.

15. angra_mainyu ◴[] No.41896075{3}[source]
An unfortunate issue. Vue is far better, as is Svelte.
16. acemarke ◴[] No.41896309[source]
The biggest thing most people don't understand is that React re-renders recursively by default, regardless of whether any particular child component's props actually changed or not. Most of its behavior patterns follow from that one.

I have an extensive post called "A (Mostly) Complete Guide to React Rendering Behavior) that covers the concepts and nuances in detail:

- https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-...

replies(1): >>41897734 #
17. 1shooner ◴[] No.41896477{3}[source]
>Sure, you'll have an easier time making decisions if someone else makes them for you.

You're comparing two tools that are both at the top of a very tall stack of pre-made decisions.

18. dotancohen ◴[] No.41897734{3}[source]
Thank you.
19. throwawayie6 ◴[] No.41899218{5}[source]
I do not hate React and am not the person who made the dumpster fire argument. The original person complained about React, and another person used popularity as a counter argument. That was what I replied to.

> That looks like tautology to me. What point are you trying to make with this?

React is in a place now, where it is the "safe" default choice for Enterprises. It's not necessarily a bad choice, but I argue that risk management is often an important part of deciding which tech to use.

It got to this point by being backed by Meta and was a genuinely good alternative to other frameworks at the time. But it is my view that enterprises prefer React not because it is the best, but because it is good enough and easy to find workers with experience. This is a self reinforcing feedback loop.

I worked in a sales driven startup some years ago and got to shape the technology as the first hire and only developer for a few months. I chose React because it was easier to recruit for and time to market was important. If I had already a team of developers with experience with another framework, I would have chosen that one even if it had been a less popular framework due. Time to market was our main focus.

More established companies don't have the same time constraints and are often more concerned about scaling up with multiple teams. A less popular framework is a bigger risk. It is "easy" to hire 10 people for any framework, but what about 100?

20. plaguuuuuu ◴[] No.41905186[source]
(caution: backend dev opinion)

I swear every time I use React, every couple of years, I wind up thinking "okay fine, but... why?"

I love JSX. But the React API, for some areas, feels complex and boilerplatey. I dunno why you have to explicitly memoize some stuff. Svelte just magics that shit away.