Live data from Hacker News

Svelte 4

svelte.dev

221–227 of 227 posts

Re: Svelte 4

#221

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…

Svelte is more like a compiler than a library. The code you ship is plain JavaScript without any svelte dependency. That’s why svelte has always been simple and fast.

Re: Svelte 4

#222
post #65
post #40

Earlier quoted context omitted.

But Svelte obviously doesn't play well with TypeScript, and is kind of its own language - you don't need a source for that. Good luck e.g. getting reactive declarations to play well with TS's type narrowing or null analysis.

you clearly don't know what you are talking about. reactive declarations do not change the type of the objects. it just that they can rerun when the dependencies change. sure for the convenience of the users you do not need to type `let vars...` for every new variable declared in the reactive statement, but no one forbid you to write it before hand, or let the language server/plugin do it for you. but Svelte indeed d…

This simply isn't true. For instance, if you narrow a variable from `1 | 2 | 3` to `1 | 2`, then trigger a reactive declaration, the reactive declaration can't understand that you've narrowed the variable, and you lose that information. Same thing happens if you go the opposite direction and broaden a variable. TS assumes that program flow roughly goes from top to bottom; if you break that invariant you lose a lot of handy features.

> you clearly don't know what you are talking about.

huh?

Re: Svelte 4

#223

Curious as to people’s experience with Svelte (or SvelteKit) for making so-called “native” apps via Electron/Taurus/etc? (I believe the new 1Password app is powered by Svelte.)

We did a pretty big one, integrated with a python/gtk app [yikes]. Anyways, svelte is a joy to work with, also on the note of libraries, svelte's community is smaller but I found by far my favourite component system I've ever used - https://carbon-components-svelte.onrender.com/ .. surprising coming from IBM, but hey, I'll take it. But in general electron was a pain, slow builds - had an adhoc solution for the svelte…

Thanks for sharing. Curious if you know the answer: what’s the difference between a “pictogram” and an “icon” in the components? I looked at a few and it seemed arbitrary?

Re: Svelte 4

#224
post #127

Earlier quoted context omitted.

The VDOM was never about performance problems with the actual dom. It was always slower as you still have to mutate the actual DOM. The "VDOM if faster" was always FUD. The VDOM was invited to prevent bugs by removing the difficult of managing fine grade DOM mutations. Technically you are doing more work with a VDOM and diffing, than carefully mutating the DOM, it's slower. Of course if you just threw away the whole…

It was not FUD. It’s not faster than carefully mutating the DOM, but back then, almost no one was “carefully mutating the DOM” all the time. It was a shit-show of ad hoc re-rendering strategies that often re-rendered excessively because no one has time to do it carefully for every case. For most common use cases, VDOM had great performance with little cognitive overhead.

There were other frameworks before React: AngularJS, Knockout.JS, Backbone.JS, ExtJS, and I'm probably missing few others... Most of them had a concept of props/dirty-checking/retained-mode and they were definitely faster than naive React.

What VDOM made easier (in terms of performance) was memoization, you could get faster if you carefully evaluated your dependencies, but to be fair, it introduced many edge-cases and many people avoid memoization to this day.

VDOM also made react-native possible, and it made cross-browser programming bearable (but other frameworks at the time did that too)

Now, one REALLY COOL thing about VDOM is fragments, because being able to render multiple elements from one component, makes certain layouts very easy using plain CSS - either with simple > * or even with CSS GRID.

I am not sure, if Svelte 4 can do that, but it's very simple thing to do with VDOM. And it certainly was not common feature for a very long time.

Re: Svelte 4

#225

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 is kind of dead. Almost no features in the last year. Look at the GitHub repo, little activity, mostly maintenance stuff. I suspect author (Evan) lost interest, given the Vue 2/3 situation (similar to Python 2/3) and the lost battle against React.

Vue 2 is getting backported features, but that will increase Vue 3 adoption in the long run as the migration hurdle becomes smaller.

Re: Svelte 4

#226
post #113

At the moment I am testing SolidJs and Svelte for a small side project and feel that SolidJs is slightly superior but Svelte will win.

Why it's superior? Because it's faster?

Re: Svelte 4

#227
post #199

One of the platforms I built before used jquery and bootstrap, while it obviously do the job but I was looking to revamp the whole UI, svelte was one of the options as it’s close to vanilla js, react is troublesome unless you enjoy your app breaks next time you update it. The only thing I’m looking for, is there any component based svelte UI I can choose from and quickly build my UI, similar to bootstrap if that make…

TailwindCSS can do it
Post reply on HN