Live data from Hacker News

Migrating from Vue 2 to Svelte

escape.tech

51–60 of 289 posts

Re: Migrating from Vue 2 to Svelte

#53
post #18

Has anyone worked on a very large Svelte project yet? I work on a large React app in real life, but have been learning Svelte in my off time - there are some nice aspects like the out of the box state management, the syntax and structure is a bit easier to learn than React, but my intuition is a Svelte project would become unwieldy for a very complex app (React class components that are hundreds of lines long with do…

We rewrote our fairly large React app in Svelte and compared to React, Svelte is an absolute dream. Developers are no longer afraid to make changes to the UI. Making changes takes less time and it's easier to get them right first time resulting in fewer bugs.

Re: Migrating from Vue 2 to Svelte

#54

Earlier quoted context omitted.

Because writing code declaratively it's much more readable than imperatively. {name} clearly state that you want name inside h1, it's colocated and faster to write than const h1=document.querySelector("h1"); h1.innerText=name; As for why we need $ or reactive is because JavaScript does not comes with a way to express reactivity. In the case of svelte this means having to come up with a syntax for the compiled languag…

> > Reading non-standard HTML just sucks > it's much more readable I guess this is just a difference in opinion then, haha. Not so different from Python vs Ruby. If we talk about bundle size, then there might be more interesting discussion. Svelte claims to be pretty small - I wonder how that pans out compared to an "equivalent" app in Vue or even vanilla JS.

> Svelte claims to be pretty small - I wonder how that pans out compared to an "equivalent" app in Vue or even vanilla JS.

I don't have helpful benchmarks here, but can anecdotally confirm that the compiling and bundling magic that svelte does is... magical. They do some really smart tree-related things at build which are (imo) a major feature leading to this quick-and-small packaging of an app.

Re: Migrating from Vue 2 to Svelte

#55

Re events - You can type events in Vue with `defineEmits`: https://vuejs.org/api/sfc-script-setup.html#defineprops-defi... Re global enums - I'm not sure what the author means about global enums - anything imported into your Vue file can be used in the ` `. Re styles - Style is automatically scoped in Vue SFC files, too - I believe it was the first component framework to do this. This article and migration seems not…

edit: Disregard, this is wrong. ----- I agree with the rest, but how do you use imported TS enums in your template? Something like this being impossible is regularly a pain point for me: slotProps.data.type === ArticleTypes.SomeType

Store a reference to the enum locally then you can use it in templates

Re: Migrating from Vue 2 to Svelte

#57

Earlier quoted context omitted.

edit: Disregard, this is wrong. ----- I agree with the rest, but how do you use imported TS enums in your template? Something like this being impossible is regularly a pain point for me: slotProps.data.type === ArticleTypes.SomeType

Store a reference to the enum locally then you can use it in templates

[deleted]

Re: Migrating from Vue 2 to Svelte

#59
It’s odd, judging from a lot of the HN comments in the recent tailwind article, people find the lack of CSS inside react components (out of the box, I’m sure there’s ways of setting it up) enough of a hassle they want to style things in HTML - just to keep their styling in the same component. Something Vue and Svelte and others solve out of the box.
Post reply on HN