News for hackers. Stuff that matters.
Re:Thoughts on Svelte by dmix on Monday March 27, 2023 @11:49AM (#35328214)
Vue 3 with <script setup /> seems to be much closer to straight JS than Vue 2's boilerplate structure, which sounds more like Svelte.

https://vuejs.org/api/sfc-script-setup.html

Re: magic in Svelte, I haven't used it but that sounds like something I'd be wary of. I like how Vue 3 takes a functional and explicit approach to defining reactivity. It's no longer grouped into buckets ala Vue 2 (data vs computed vs methods etc) but rather you write normal non-reactive JS by default and wrap values in reactive() or computed() when you need reactivity.

The only syntactic downside is reactive values always need to use foo.value to access foo's data which causes occasional bugs when you forget it (and it tends to fail quietly) but it makes sense why it is that way. Maybe better LSP/IDE integration can detect that.

It's good to hear Svelte has .svelte files like .vue SFC. That would be the biggest thing I'd miss with React.

Re:Thoughts on Svelte by fenomas on Monday March 27, 2023 @12:41PM (#35328875)
Oh neat, I hadn't seen Vue3/script-setup, it looks very similar to Svelte. The magic I referred to was basically just wrapping reactive logic around variable assignments, so if you're familiar with Vue3 then you it sounds like you may not consider Svelte magical at all.