Live data from Hacker News

Svelte 4

svelte.dev

101–110 of 227 posts

Re: Svelte 4

#101
post #13

Could someone give a one or two sentence explanation of why I would want to use Svelte over something like React? I have heard it is "better", but have never understood why.

The most important thing to know about Svelte is that it doesn't have a runtime. All the magic occurs in places that look magic, and all the magic happens at compile time; at runtime it's simply a library. By contrast, React's VDOM system not only adds significant cognitive complexity but performs terribly too.

Re: Svelte 4

#102
post #94

Earlier quoted context omitted.

Speaking about size reduction, I once had a client who want me to update his product as it became extremely slow and buggy. The product was an MS Word Add-In that was run on an MS Surface which takes shots using webcam and insert them into the active document, it was built in .Net and the previous developer used, as I recall, OpenCV library to take the shots. The installation binary was around 300MB! And, to add insu…

> clean Surface Eh, that's not a fair comparison, Windows bundles the .NET standard libraries and runtime.

I might misused the term clean surface, I do not mean a fresh OS install but a surface tablet that hadn’t the old product installed so he can confirm my product do not use any of dependencies of the previous one.

Re: Svelte 4

#103

hope it adds a client side router, and provides a true SPA mode(not the sveltekit stuff), before then, no plan to use svelte again as my use cases is 100% SPA with 0% SSR, absolutely nothing with SSR.

You can use SvelteKit without SSR; it can be compiled for many backends, including static files.

Re: Svelte 4

#104
post #93

This is odd timing with Rich Harris just releasing a course on Svelte v3 on Frontend Masters (June 12th 2023). https://frontendmasters.com/courses/svelte-v2/ From the migration there does appear to be some breaking changes, don't know how that aligns with the course which I planned to take. His old course was good as well, but that relied on Sapper.

The breaking changes aren't really gamechanging stuff, just cleaning up baggage in preparation for Svelte 4.x and Svelte 5. The course would still be fully applicable

Gotcha, thanks for the clarification. I really enjoyed his course last time, I also wish he would put out some data viz content too. I bet he develop lots of good insights during his tenure at the NYT, but understand he is tied up with Svelte atm :D

Re: Svelte 4

#105

hope it adds a client side router, and provides a true SPA mode(not the sveltekit stuff), before then, no plan to use svelte again as my use cases is 100% SPA with 0% SSR, absolutely nothing with SSR.

There are pure SPA svelte routers: https://github.com/ItalyPaleAle/svelte-spa-router

Re: Svelte 4

#106
post #19
post #13

Could someone give a one or two sentence explanation of why I would want to use Svelte over something like React? I have heard it is "better", but have never understood why.

Svelte tries to improve upon the relatively complex/heavyweight runtime of something like React by shifting as much of that complexity to the build step as possible. It also takes a more "batteries-included" approach compared to React by including some opinionated features like state management, animation, transitions and the like. I haven't dug too deeply into Svelte because last I checked it didn't play particularl…

I'd argue that Svelte is less opinionated than React in most areas. The whole hook system depends on a ton of hidden state that React manages itself.

Svelte state management, for example, is just the `subscribe(callback: () => void) => Unsubscriber` interface. A couple of utility store functions are provided like `writable` and `derived` but state management libraries don't need to know anything about Svelte, just provide that single life cycle method. The context API looks almost exactly like React's.

Re: Svelte 4

#107
post #13

Could someone give a one or two sentence explanation of why I would want to use Svelte over something like React? I have heard it is "better", but have never understood why.

JS frameworks are like coffee, some people like them milky and full of sugar, some people like them like them lean and black, some are obsessed with making the "worlds best coffee" at home every morning, and some drink whatever brown water comes out of a vending machine. We all like our coffee different, just as we all have favourite features and designs of frameworks. There is no correct, or best, framework, only pe…

Big disagree on the not using a framework part: far too often that's not so much a lovingly honed craft but an echo of the "websites should work just fine without JavaScript" that has long been given up as a goal but still haunts decisionmaking as an ideal that now serves as an excuse to consider everything client side secondary citizen. "It's JavaScript, right? It's supposed to an unmaintainable mess." If you dig deeper you will often hear something like "And anyways, jquery 3 is still the latest major release so this is definitely state of the art"

Re: Svelte 4

#108

Time for a very naive question. As somebody looking for a more effcient (less re-rendering) and nicer DX (template based, stuff like exit animations) alternative to React, what actually makes Svelte measurably better than Vue? On first (and very naive) look the two seem pretty similar, with the biggest difference being that Vue seems to have the much bigger ecosystem and more mature tooling (I keep hearing about Svel…

Vue 3 (with is quite close to Svelte in terms of DX, but Svelte has the edge here. Svelte is so simple, elegant and concise.

The biggest advantage of Vue is the ecosystem. However, Svelte is catching up. Some interesting UI component libs have recently arisen, e.g. https://skeleton.dev.

Performance wise, both are super fast.

Make sure to check out Sveltekit, even for building pure SPAs. The routing and data loading are worth it alone.

Re: Svelte 4

#109
post #94
post #4

> Svelte 4 reduces the Svelte package size by nearly 75% (10.6 MB down to 2.8 MB), which means less waiting on npm install. This improvement will be especially noticeable for users who are loading our interactive learning experience on learn.svelte.dev for the first time, users of the Svelte REPL, and users with limited connectivity. The majority of the remaining package size is eslint support, which necessitates dis…

Speaking about size reduction, I once had a client who want me to update his product as it became extremely slow and buggy. The product was an MS Word Add-In that was run on an MS Surface which takes shots using webcam and insert them into the active document, it was built in .Net and the previous developer used, as I recall, OpenCV library to take the shots. The installation binary was around 300MB! And, to add insu…

How old was the Add-In? Did the tiny lib you used exist back then and did it support the Surface webcam?

Re: Svelte 4

#110
post #107

Earlier quoted context omitted.

JS frameworks are like coffee, some people like them milky and full of sugar, some people like them like them lean and black, some are obsessed with making the "worlds best coffee" at home every morning, and some drink whatever brown water comes out of a vending machine. We all like our coffee different, just as we all have favourite features and designs of frameworks. There is no correct, or best, framework, only pe…

Big disagree on the not using a framework part: far too often that's not so much a lovingly honed craft but an echo of the "websites should work just fine without JavaScript" that has long been given up as a goal but still haunts decisionmaking as an ideal that now serves as an excuse to consider everything client side secondary citizen. "It's JavaScript, right? It's supposed to an unmaintainable mess." If you dig de…

People can lovingly craft really bad coffee, just as much as good. To them it may be exactly what they want, and that's all that matters.
Post reply on HN