Live data from Hacker News

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

joshcollinsworth.com

91–100 of 213 posts

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

#91
post #77
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…

One of React's competitive advantages is React Native. That's hard to beat.

there is svelte-native based on Nativescript. it is similar fast or faster[1] and provides the ability to directly use every native function in JS without having to rely on new interfaces or build versions (e.g. you can directly access new APIs from JS). beeing able to use Svelte makes it sooo much easier to develop mobile apps.

[1] https://blog.nativescript.org/perf-metrics-universal-javascr...

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

#92
post #67
post #28

Earlier quoted context omitted.

In vue 2, objects are made reactive with getters/setters, so changing a field on an object can be tracked. That still exists in vue 3, but a separate api was needed for primitives like numbers or strings, without a parent object that they'be set to. Vue3's solution is to wrap it in a wrapper object called a ref, and to read it's value you have to use .value. It's a pretty simple concept. In svelte, top level variable…

Yes! This was exactly what I felt was more "natural" in Svelte. I also like Svelte's "writable store" model rather than React's Redux which forces data to flow a certain way, through the dispatcher. Svelte Stores make it a little too easy to "shoot yourself in the foot" if you're not too careful though, as you can make data bi-directional, and you can make children set parent data. This makes prototyping super easy a…

These days in reactland, you can easily get app-wide state using useContext (which is much MUCH simpler to work with than Redux). It's just a global store (well, or you can limit it to a certain part of the tree) that any child or sibling can read/write to at will.

But just like you said, it can be a footgun if you're not careful.

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

#93
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…

This is my experience as well (in a similar situation to you). I also found Svelte far easier to grok, as someone who is generally not a web developer, than alternatives. Not having to bundle a huge runtime and deal with all the virtual DOM cruft is a nice bonus for performance, but the reality is that it's probably not a measurable difference for anything I'm doing on the front end.

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

#94
post #22

Personally to me the best framework is no framework at all. Instead I use libraries of code and Web Components. The libraries are either my own or some existing ones. Overall writing web front end this way for me is the most natural way. In my personal experience I spend less time creating the web front ends this way comparatively to when using "frameworks". No "compiling" is needed either, other then optional minimi…

That can work relatively well for projects where there are a handful of engineers, but I wonder whether it doesn’t be some much harder as your team grows to 20+ engineers working in the same UI code base?

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

#95
post #25
post #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.

This should really be an explicit goal of a frontend framework and a pain point I have encountered often in React and Angular. How are you supposed to debug stuff if the stack trace isn't even legible?

Does using a debugger help? (like in VScode or IntelliJ). The React stack trace is so useless I find myself just stepping through the code and setting breakpoints when I need to actually locate the source of an issue.

Is there a better way, in React or other languages?

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

#96
post #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 promi…

Just throwing this out there, but have you considered that React and Vue in fact also have custom non-JS syntax? JSX is not valid JS, parsers had to be written to work with it. And Vue uses templating syntax in HTML, just like Svelte. Svelte doesn't have any non-native syntax in the JS parts, just the templating.

> but have you considered that React and Vue in fact also have custom non-JS syntax?

I 100% agree, and I never fully got this argument. But my God do people love to repeat it. So much of react's initial fervor was around "it's just javascript". I write a lot of vue code and I only use like half a dozen directives and learning all of them should take less than one afternoon. And yet, the number of people that don't like vue because of a very simple DSL has been staggering.

It really doesn't make sense to me, but people seem to really hate learning something that superficially looks different.

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

#97
"Introducing"? Hasn't Svelte existed for a couple of years already? I remember a speaker talking about it on a conference some time before Covid hit.

Still, it's a great article that does a good job of showing how easy Svelte is. I think it looks most like Vue, but simpler, with even less boilerplate.

Of course keeping everything so simple does make me wonder how it would deal with more complex situations where you really do need a lot more structure.

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

#98
post #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.…

Might want to check out Remix too, though I ended up going back to Next due to ergonomics and also just generally more experience Nexting.

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

#99
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…

It's a case of "Nobody ever got fired for choosing X"[0]. No one would blame you for choosing React for a major project / new startup, but someone could definitely poke holes in choosing Svelte ("theres no package for X", "it doesn't scale", "we can't find devs that know it", etc.) 0 - https://www.quora.com/What-does-the-phrase-Nobody-ever-got-f...

The answer is always Ember.js. No doubt. It is just getting better and better and knows everything. The best choice.

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

#100
I loved using Svelte for these two open-source projects but haven't yet an opportunity to use it at work:

- An SVG-based graph dataset editor: https://codeberg.org/nilesh/grapher

- A curated collection of educational resources: https://github.com/learn-awesome/learndb

Compared to React, developing with Svelte felt like a breath of fresh air.

Post reply on HN