Live data from Hacker News

Introducing Svelte, and Comparing Svelte with React and Vue (2021)

joshcollinsworth.com

11–20 of 213 posts

Re: Introducing Svelte, and Comparing Svelte with React and Vue (2021)

#11
I work with React (Next.js) on my main project and while I don't appreciate some things generally I haven't had any issues and Next.js in particular has been great. I also find JSX stellar.

I used Vue from 0.12 until around ~2.5, I really liked it at the beginning (coming from a jQuery only world) but I was forced into learning React for React Native and then I kind of standardized on it for a while and Vue fell off.

I used Svelte for a side project recently and it was quite enjoyable but I do really miss JSX and I don't like the $: syntax. I plan to give SolidJS a try on my next side project and then I'll standardize on either Svelte or SolidJS for side projects and React for big things.

Since Svelte and SolidJS are such great options for smaller things I kind of don't have a use case for Vue anymore, but I do remember it fondly.

Re: Introducing Svelte, and Comparing Svelte with React and Vue (2021)

#12
I don't see how Svelte is "React without all of the bullshit", Svelte really seems like the complete opposite of React. To me it's more like a modern Angular 1 where it's a magic HTML DSL (just now with a compile step to make it more optimized). For instance, Angular 1 had the ng-if attribute in templates for optionally including parts of the template based on JS values and Svelte has {#if ... } blocks in templates that do similar. Whereas React is just JavaScript, you just write a function and ifs like anywhere else.

Seeing Svelte take the global variables (are they now not global because of Svelte's compiler? probably) in a tag and binding them to HTML elements seems too magic for me. Whereas at least with React, I can sort of understand how it works under the hood and could probably write a poorly optimized version of it without thinking much about it.

React isn't perfect by a long shot so I think something will eventually overtake it, but I hope it's not magic HTML templates, that seems like a step back.

Re: Introducing Svelte, and Comparing Svelte with React and Vue (2021)

#13
post #5

The only thing I don't like about Svelte is the reactive blocks, prefixed with $:. There are a number of gotchas, like updating complex objects, which make things a bit...implicit rather than explicit.

Rule of thumb is: it's fired after assignment of a named variable from the root scope which was mentioned in this reactive block.

You can even add a line that just says `myVar;` and the reactive block containing it will be executed on every `myVar = ...`.

Re: Introducing Svelte, and Comparing Svelte with React and Vue (2021)

#14
post #7

I'd really like to hear more from Svelte devs about what non-happy paths look like. I specialise in React.js and there are any number of escape hatches to make sure you can get something working just the way you want. What I fear about Svelte is getting to 95% complete and finding the one obscure thing a stakeholder will not budge on is not possible.

The one 5% thing I’ve run into is a lack of proper generic component props when using Typescript.

Granted, that’s a rather advanced topic, but I miss having a > where all the type checking “just works”.

It’s not a dealbreaker - more like just something I noticed coming from the React world.

Re: Introducing Svelte, and Comparing Svelte with React and Vue (2021)

#15
post #8
post #3

I've worked with all three frameworks, but as a mostly single dev/engineer I very very much prefer Svelte because it lacks a lot of boilerplate that React has, and it's easier to think about than Vue's clunky way to write variables and functions. But I'm a "hacker type" and don't work in a large tech company. I haven't seen Svelte in any sort of "real tech companies", haven't seen it on job boards, and it doesn't see…

Out of curiosity, what do you find clunky about Vue's variables vs Svelte? I've been working exclusively with Vue for the last... 6 years. Since the launch of v2. So my mind is already conditioned ;-)

You don’t need to write .value’s everywhere, that’s about all. And Vue is a lot more convenient in other ways.

Re: Introducing Svelte, and Comparing Svelte with React and Vue (2021)

#16
My 2c: I think svelte is overhyped and a poor solution to the problem it's trying to solve.

First of all, I am tired of ridiculous metrics like how small svelte is when it's a really small example, and it's one or two lines of initial boilerplate.

The thing that really set svelte apart was it's better syntax and experience when it first came out. I think that was when react class components, and vue 2 was still prominent. Look at the react and vue 3 examples now. They're really close. Vue 3 in particular looks a lot like svelte with vue's sfc.

I don't even think the dissapearing part about svelte is that important. That kind of performance is rarely going to matter before other bottlenecks. And if it really is that crucial, there's nothing stopping either react or vue 3 from doing something very similar. Vue 3 already has sfc that go through a "compile" process, and it uses getter/setters to make targetted changes.

There's also some considerable challenges to svelte: it's brining in custom syntax to really tackle the problems with reactivity. That's honestly really good if we could get one unifying system. It would be wonderful. But that's a tall order. Given how much traction these other tools already have, I don't see svelte ever fully dominating. Which makes it's extra magic and custom language features even more of a burden. People already complain about vue's few dsl's in the template or react's hooks.

Finally the eco-system for the other tools have come so far. Given how much the gap has closed, and how much farther the other tools are, the better ecosystems make them much better choices. Also as much as I respect Rich Harris, it's a tough sell against people the momentum of something like Facebook or even Evan You with vue and related tools like vite. I know he's working full-time on svelte now at vercel, but the corporate side of this as well as maintaining a community around this is another hurdle. Say wha t you will about react, nobody got fired for choosing it. On the other hand, it's a punch in the gut to jump on something like sapper and then have it be oddly deprecated/rolled into sveltekit.

Re: Introducing Svelte, and Comparing Svelte with React and Vue (2021)

#17
I've recently started working with Svelte and have been loving it compared to React. A lot of stuff flows through very intuitively.

However, for any front-end framework, the UI is paramount, and the most full-fledged component framework I found was Carbon Components[0].

I've heard rave reviews about Quasar[1] for Vue 3. Are there any equivalent UI component frameworks for Svelte?

[0]: https://carbondesignsystem.com/developing/frameworks/svelte/

[1]: https://quasar.dev/layout/grid/row

Re: Introducing Svelte, and Comparing Svelte with React and Vue (2021)

#19
post #9

If you want something that is a bit lighter weight, check out Surplus. It's been around for ages, is used for real projects, and has a lot of the same design patterns Svelte adopted, without a lot of the extra language semantics.

Do you mean this? https://github.com/adamhaile/surplus

That's the one.

Re: Introducing Svelte, and Comparing Svelte with React and Vue (2021)

#20
One (sort of accidental I assume) selling point of Svelte that wasn't mentioned here is that the stack trace is legible.

Working with this framework I found that it was very easy for me to trace back to where the change that caused the error happened.

You don't get this in most frameworks, which hide everything under layers of event handlers, schedulers and whatnot.

Post reply on HN