Live data from Hacker News

Migrating from Vue 2 to Svelte

escape.tech

151–160 of 289 posts

Re: Migrating from Vue 2 to Svelte

#151
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

Solid does have state management. Its state management primitives can be used outside components and can even be used completely on their own, and its stores are fairly similar to Svelte stores.

https://www.solidjs.com/docs/latest/api#stores

Re: Migrating from Vue 2 to Svelte

#152

Earlier quoted context omitted.

As someone working in a large Vue 2 app: - Very poor typescript support. - Poor performance (compared to Vue 3). - Ecosystem has already started lagging behind (e.g. Vue Testing Library for v2 has out of date dependencies, and no one is actively maintaining it) - Nuxt 2 hasn't made any releases in ages.

> - Very poor typescript support. If you use class components and prop decorators, the TS support is actually pretty nice. Kinda boilerplate heavy, but nice.

I've worked professionally in both Vue 2 and React. Even with class components and prop decorators you still have the annoying Vue template DSL where you don't get any TS support.

In comparison JSX will be checked by typescript, so in that regard JSX (and therefore React) is superior.

Re: Migrating from Vue 2 to Svelte

#153

One huge thing that I feel nobody talks about about Svelte is that there is no easy way to pass components as props. Sure, there is slots and svelte:component but the ergonomics just don't match.

I see that as an advantage. Everytime I see components passed as props or a callback passed as child in react I regard it as a big red flag that something is wrong with the architecture of either the app or react itself.

It's funny; I often see it the opposite way. Passing components as props enables inversion of control and usually helps split responsibilities up more easily and generally avoids prop drilling or super components that do everything.

Re: Migrating from Vue 2 to Svelte

#154
post #85
post #82

I didn't see anything about type checking. We have a pretty sizeable Vue2 app written in TypeScript (well, mostly, because some devs...), and using Component/Prop/etc. decorators, it's very readable. The html template checker/compiler unfortunately doesn't see the data types, but apart from that, type checking is almost perfect within a component. That saves so much time. And it has optionally scoped styles too.

There’s literally an entire section on type checking. With a comparison table and everything.

I don't see it. It mentions typed events, but that's all I see. No type checking on class/component members.

Re: Migrating from Vue 2 to Svelte

#157

As someone who switched from Vue 2 to React around when hooks were introduced, can someone explain to me why they like non-React frameworks? Based on my experience, they all have some drawbacks: - Template languages instead of JS. If I want to perform some operation, I have to use their if and for constructs in their unique template language. In React I can just write JS. - Due to the above, TypeScript support is oft…

I'm primarily a React user and would generally agree with you, but I understand why people like Vue/Svelte.

- Templating languages have been around for years, and for many, they feel like the right way to write markup. If someone has used Handlebars in the past, the templating constructs feel familiar. There is also the idea of keeping logic out of your views with the restricted feature set of your templating language. Finally, conditional logic is simply easier in a templating language vs JSX. This will be true until we get pattern matching or the do expression, ternaries, and boolean expressions are clunky. Solid added constructs for conditions and looping to JSX, mainly for performance, but it's much more ergonomic.

- People like the SFC pattern precisely because everything is separate. Your logic is separate from your markup, which is separate from your styling. For me, it feels like a throwback to the times of MVC when it was good and proper to separate your concerns that way. Some reject React out of hand because "there's no default solution for styling".

- The composition API in Vue 3 and Svelte's stores provide the same abstraction potential as hooks. Their reactive primitives aren't tied to the component lifecycle, which is a really nice benefit. It avoids a lot of the context performance pain that people can end up in.

Overall, I'm not really sold on SFCs. They inherently limit you to one component per file, a tradeoff I don't like. There are also the type and IDE support issues which will always be an uphill battle. Template languages are at least better than lashing everything in template strings which is becoming a thing now.

Re: Migrating from Vue 2 to Svelte

#158

The very first paragraph leads me to believe this is just a rewrite into svelte for the sake of it - I get it, Svelte is the new hotness on the FE-js-block, but this entire post stinks of "someone on the dev team advocated and fluffed enough figures to convince us. So now we're going to tell you why it was the right choice!" I say all this pretty confidently as someone currently maintaining a massive legacy vue2 app…

Looks like we finally have a winner of the Frontend Wars.

Re: Migrating from Vue 2 to Svelte

#159

The very first paragraph leads me to believe this is just a rewrite into svelte for the sake of it - I get it, Svelte is the new hotness on the FE-js-block, but this entire post stinks of "someone on the dev team advocated and fluffed enough figures to convince us. So now we're going to tell you why it was the right choice!" I say all this pretty confidently as someone currently maintaining a massive legacy vue2 app…

Wowowow stop.. last time I seriously looked aeons ago (4 or 5 years? :D) there was Vue as the nice smaller thing as an alternative React.. besides some other few bigger names. Noe Vue2, and Vue3? That didn't age well? And Svelte? Omg, doing (because I need to) C or C++ stuff, where you have (or lets say you are bound to for several reasons, compatibility, regulations,..) C++11.. or even C99 .. man I feel so old and s…

Spotty support for C++17/C++20 is very annoying. Maybe if you stick to one platform and one language edition on one compiler you'll have a nice and stable C++ experience, but that's no different from Javascript. We adopt new things because we want better things, having some of those things fail or quickly deprecate is a risk that comes with that territory.

BTW just a snarky aside, but I've never seen any of the Javascript frameworks make as bad design decisions as the C++11/C++14 standards committees have. At least when you use a one-day-fly JS framework you'll use something that was actually designed with a grain of intelligence.

Post reply on HN