Live data from Hacker News

Migrating from Vue 2 to Svelte

escape.tech

31–40 of 289 posts

Re: Migrating from Vue 2 to Svelte

#31
post #7

Still don't understand why people prefer magic templated front-end frameworks. Reading non-standard HTML just sucks. What even is "$:" or why does Vue require non-standard javascript ref("") objects...

Because in many cases, manipulating the DOM with vanilla JS sucks way more than writing declarative code with a framework.

Re: Migrating from Vue 2 to Svelte

#33
post #7

Still don't understand why people prefer magic templated front-end frameworks. Reading non-standard HTML just sucks. What even is "$:" or why does Vue require non-standard javascript ref("") objects...

The answer is because their websites are overly complicated system design take home rejects to begin with

But these must be maintained now

Very few sites need to be applications

Re: Migrating from Vue 2 to Svelte

#34
Some months ago I did the same thing as TFA - took a look at Vue3 and decided to change my main project's UI from Vue2 to svelte. So far I've been really happy with it.

In my case the big motivator was that with Vue, whenever I worked on my UI code I found I spent most of my time thinking about Vue and not about the UI. I think the key issue was that Vue seems to offer several different abstractions for each of the things it does, so there's generally lots of different ways you could architect any one thing - e.g. how to make a piece of state inside one component accessible from another. Then when I saw Vue3 was adding a new, apparently separate way of doing things (the composition API), but also not deprecating any current abstractions, that was what specifically made me start looking for alternatives.

In contrast I've found svelte less mature (and I've had to work around some bugs), but it's been infinitely easier to work with. Svelte basically just has One Magical Thing, and otherwise everything is plain JS (or at least looks like plain JS). So there's nothing to re-learn when I come back to the UI after not touching it for a month, and I don't really find myself thinking about any svelte-specific details when deciding how to architect each component or piece of state.

I'm only using a small subset of each library (e.g. I don't use routing or SSR), so YMMV. But so far I'm really happy I switched, and my UI code has gotten smaller and cleaner.

Re: Migrating from Vue 2 to Svelte

#35
post #28
post #13

Solid JS is what I would have chosen. Not sure if they considered it. Best performance and dev experience with least 'magic' of all frameworks I've tried.

what do you like about the dev experience? i have a hard time seeing solid as something more than “react but faster and slightly less annoying”. still doesnt have scoped styles, animation, state mgmt, head management, etc out of the box, all minimum things i look for to be productive

They recently released a beta of SolidStart, their answer to Next.js/SvelteKit/Remix, etc, and I’ve been really liking it. A lot of good ideas pulled from the other frameworks. https://www.solidjs.com/blog/introducing-solidstart

Re: Migrating from Vue 2 to Svelte

#36
I'm missing the raw numbers. Increased performance? Faster code execution? By how much? I'm sure Svelte is faster, but if we're talking 10% improvement it doesn't really matter.

Additionally...

  {@html
    Prism.highlight(code, Prism.languages[lang], lang)
  }
looks very unsafe to me. (Vue example has the exact same problem)

Re: Migrating from Vue 2 to Svelte

#38
As an outsider (I mainly develop backends), but occasionaly working on frontends, Svelte is the one I found easier to use, that is the most useful for me without having to learn too much above what I already know about html/js/css.

I wish it had something like vuetify though.

Re: Migrating from Vue 2 to Svelte

#40
post #29
post #7

Still don't understand why people prefer magic templated front-end frameworks. Reading non-standard HTML just sucks. What even is "$:" or why does Vue require non-standard javascript ref("") objects...

and JSX somehow gets your blessing? let he who is without sin…

I'm not the one who wrote above but I see JSX as having fewer magic things than all other template languages I've seen. Take a look at Angular to see some complicated syntaxes examples. Vue and Svelte are better but, IMHO, not as easy as JSX.
Post reply on HN