Migrating from Vue 2 to Svelte
51–60 of 289 posts
Re: Migrating from Vue 2 to Svelte
#52Re: Migrating from Vue 2 to Svelte
#53Has 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…
Re: Migrating from Vue 2 to Svelte
#54Earlier 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.
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
#55Re 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
Re: Migrating from Vue 2 to Svelte
#56 Only single brackets are necessary in Svelte
//Svelte
{fullName}
//Vue
{{fullName}}
hmmRe: Migrating from Vue 2 to Svelte
#57Earlier 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
Re: Migrating from Vue 2 to Svelte
#58Re: Migrating from Vue 2 to Svelte
#59Re: Migrating from Vue 2 to Svelte
#60Articles like this make me wish Elm was still under active development to smooth out its pain points and also not so weirdly hostile towards forks.