Live data from Hacker News

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

joshcollinsworth.com

61–70 of 213 posts

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

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

I agree. The "DSL" and "compiling" aspect of frameworks scares the crap out of me frankly. And on top, it's all happening on my poor users device - well not for Svelte apparently.

Let's have a look at this "compiled" JS. Here's an snippet from the volume slider in his example:

function b() { v = W4(this.value), h(0, v) }

I understand that this is "compiled" - but really it's not - it's EcmaScript. If I wrote code like that, I'd get fired.

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

#62
post #43
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…

I know svelte is a very common choice for larger news sites to build interactive stories. Ive specifically heart of NYT using it as well as pudding.cool. It makes sense for this small website extension because you can build and compile a small component without having to bundle the entire react runtime in.

The guy who created it, Rich Harris, used to work for the New York Times and developed it while he was there. So it's not a big surprise that NYT use it. I'm not sure about many other 'larger news sites' using it, but one place I have seen it out in the wild in a big production app is the Apple Music web app.

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

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

Re: Sapper -> Sveltekit, you might say the same thing for React Router users who adopted Reach-router, back to react-router and are now on remix-router or next.js router.

Also I found it weird that you mention Evan You WRT vite as a counter to why Rich might be up against stronger devs, but Rich made rollup, which was foundational to Vite's bundling.

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

#64

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/d…

Uhm, Carbon supports Svelte too ...

Yes, I think that's the point. Carbon does, but there aren't (many) others.

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

#65

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 t…

If you mean Stores, those are Observables (implement that interface similar to rxjs which is used heavily in Angular)

It's a solid pattern that solves a lot of issues in a pragmatic way.

Keep in mind "modern" react is easy less clunky, so the whole state management thing is easier with hooks so it's not as impressive how easy svelte is now at it was when it was introduced 5 years ago.

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

#67
post #28
post #23

Earlier quoted context omitted.

Do you mean .value when writing a component that's some sort of form field? How do you refer to that value in Svelte components? edit: oh nvm, we haven't upgraded our codebase to Vue 3 yet, there are a lot more ".value"'s if you click through to the Vue 3 examples in the original post.

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 and fast, but probably creates massive code readability problems down the line, especially for larger teams.

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

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

Apple Music Web version is made using Svelte https://beta.music.apple.com/us/browse

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

#69
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.

In my opinion parser is not a problem. I'm using tsx so there'll be compiling anyway.

Now if they make tsx native it'll be game changing

Post reply on HN