Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Svelte 5 release candidate (RC) (svelte.dev)
32 points by benmccann on April 30, 2024 | hide | past | favorite | 17 comments


I'm the person that's been using React for 10 years and suddenly thought... I wonder what the big deal with Svelte is? I built a non-trivial project in Svelte for my personal site and something weird happened. I was having fun again. Svelte feels pretty close to vanilla and I like that the code I'm writing feels a lot more similar to how I wrote code before I ended up in React. Style tags, script tags, easy assignment of variables, no useEffect head-scratching. You declare things, you change them, and it mostly just works. The code looks pretty similar to a regular old webpage.

My favorite thing about learning Svelte was that it has my favorite "documentation" of any library. It's just a list of code samples showing various different scenarios [0]. This made it dead easy for me to understand its way of doing things without needing to get too deep into the methodology.

[0]: https://svelte.dev/examples/hello-world


Have you tried Solid to compare by any chance? I'm also growing weary of React and curious.


Only briefly. I did enough to realize Solid felt like a flavor of what I'd already been doing in React. Svelte felt more like some extras I could throw on JavaScript itself.

Honestly, the biggest thing with all of these systems is what library support do they have beyond the core? I specifically need a good component library, and want to do things with Three JS. Svelte had that covered.


I say this as a long time Svelte fan, and maintained some libraries for past 7 years: I really don't like the DX of "runes". What I liked about Svelte was the two way and automatic reactivity, clever computed values prefixed with $:, etc. The code looked simple and clean.

I know there's very good reasons for the changes, but it feels so similar to React (and even hooks) now that I don't see any big positives to using Svelte vs just using React. Sorry Rich.


> The code looked simple and clean

I feel the same way, but after watching a couple of the videos Rich has put out I thought the main driver for the change were the “gotchas”. I have not done production Svelte development so I never really dealt with any of that. Given you’re background, are the caveats/pitfalls he mentions not common to your projects or do you just view the critique as newby problems?


Yes, I've not run into these, even though I know they are possibilities (like with any framework). Simple webapps doing webapp-things always seem fine for the performance and any gotchas.


Keep in mind there is a large performance gap between them.


Yes, but performance for my normal needs were already quite fine.


> In Svelte 3 and 4, components are classes. In Svelte 5 they are functions and should be instantiated differently.

This is classic React!


Not exactly, in Svelte you don't declare components in plain js, you create a svelte file and the compiler does the rest. Whether a component is a function or a class is an internal detail you don't need to know, except in the case you are instantiating a component manually, which is a edge case.


Happy for the Svelte team.

I picked up Svelte 3, and 4 last year and used it to build many browser extension UIs.

I really enjoyed my time with Svelte but I found it did not scale well. Maybe that’s a me problem though.

I’ve since switched over to using React, and I’m really enjoying writing React. NOT working with others React code though, that still sucks.

But I’ve actually switched to using React for my browser extension UIs. Prefer it


I agree with Rich's take that classes are mostly bad when you do things like inheritance.

However, I don't really know why he thinks classes are awesome without inheritance, either. Once you do away with inheritance, what's the benefit over writing a function that builds an object? Get rid of the middle man, the extra keywords, the prototype chain, etc., and go with a function. Did I miss something?


Where does Rich mention classes are mostly bad when using inheritance?

I don’t disagree, but I never got to hear/read his thoughts on that subject.

And yeah - I like the idea of defending any use of classes instead of reaching for them to brush your teeth. Some places (my current place) will reach for classes all the time without even the excuse of bundling state.


I started using Svelte 4 as I got tired of React constantly changing. Jokes on me it seems.

Any recommendations for building SPAs that can last a decade without constant rewrites?


Your-own-framework.

There's nothing stopping you from staying on an old version of Svelte or React, you just won't have access to all the new goodies and the surrounding ecosystem.

To add to the other comment, Mithril.js is another frame work that hasn't changed much for the last 7 years.


React class components from 2014 literally work without much changes (bar 2-3 APIs like componentWillMount & componentWillReceiveProps). No one forces you to use the new stuff.

Every non-dead project is evolving and is adding new things. Even behemoths like Java or C++. But maybe Ember.js is technically not dead and is mostly the same? I don't know, it's bad and I prefer rolling with the tide.


I'll just keep on using Svelte 4




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: