Live data from Hacker News

Comparing Svelte and React

jackfranklin.co.uk

111–120 of 338 posts

Re: Comparing Svelte and React

#111

I'm a big fan of Svelte. I've raved about their documentation before, but it bears repeating: this should be the gold standard. You can read it all in a day. There are examples to follow right next to the documentation. Svelte is both succinct and powerful. I find this in contrast to React which is often baffling and incoherent. I say this as someone that has used React professionally for 6 years. They've changed the…

I think many people adopted React because Facebook was behind it, and using it in production, the ecosystem is huge, there is a react- package for everything you can image, there is also react-native, I don't like it, but there it is, you can reuse the knowledge to build native mobile apps. Now Svelte, I haven't been following, but I think the creators are working in what's going to be next and even better framework[…

I don’t think any of your arguments in favour of react are sufficient. JQuery had a huge number of libraries and could be used to make websites that worked. Angular was backed by Google who generally have more clout than Facebook. I think most comparisons would find that jQuery does not solve the same problems and that angular resembles the kind of steaming brown thing one might find behind a cow—and that’s before you consider backwards compatibility.

I would argue that react has some particular merits (for three the whole vdom based architecture, using jsx, and unidirectional data flow), that it was the first (widely known) framework with those merits, and that it has generally been backwards compatible or only required simple changes. I think these do a better job of explaining why react became popular and inertia explains why it is still popular.

Re: Comparing Svelte and React

#112
post #53

How's unit testing in Svelte today? That's the main worry I have with template-based systems (well, that and TypeScript support, but I hear that that's quite OK now).

Shameless self promotion, but my testing library, Luna, supports testing Svelte components out of the box.

https://craig.is/testing/code

Full documentation on Github:

https://github.com/ccampbell/luna-testing

Re: Comparing Svelte and React

#113

I'm a big fan of Svelte. I've raved about their documentation before, but it bears repeating: this should be the gold standard. You can read it all in a day. There are examples to follow right next to the documentation. Svelte is both succinct and powerful. I find this in contrast to React which is often baffling and incoherent. I say this as someone that has used React professionally for 6 years. They've changed the…

I've only dabbled with Svelte, but I agree that it looks like an excellent framework, in itself. Powerful abstractions, succinct and approachable syntax, and it compiles down to a truly compact output. (Not the usual only a few hundred kilobytes when gzipped.)

I ended up not using it though, as the surrounding ecosystem just isn't there. There are two different material design frameworks out there for Svelte, neither of which I could get to work. I ended up opting for Angular+Angular Material, which worked out of the box.

Re: Comparing Svelte and React

#114

I'm a big fan of Svelte. I've raved about their documentation before, but it bears repeating: this should be the gold standard. You can read it all in a day. There are examples to follow right next to the documentation. Svelte is both succinct and powerful. I find this in contrast to React which is often baffling and incoherent. I say this as someone that has used React professionally for 6 years. They've changed the…

I did some React development some years ago, and was glad to move away from it because of the ridiculous churn in the ecosystem. It was like building on top of quicksand. At the time, I thought it was because React was new, and new stuff tends to have churn because people are just figuring out the optimum patterns and false starts are to be expected. When I look into React years later, the churn is still going on, which perhaps is a warning sign it just wasn't well thought through to begin with, or that the ecosystem has been captured by architecture astronauts on a lifelong quest for some kind of pure ideal rather than usability and stability.

Re: Comparing Svelte and React

#115

I'm a big fan of Svelte. I've raved about their documentation before, but it bears repeating: this should be the gold standard. You can read it all in a day. There are examples to follow right next to the documentation. Svelte is both succinct and powerful. I find this in contrast to React which is often baffling and incoherent. I say this as someone that has used React professionally for 6 years. They've changed the…

IMO, Svelte’s biggest issue is it didn’t come out of FAANG.

biggest issue of Svelte (and vue and others) is that mutable state is marketed as a feature. If you don't like mutable state anyway then it just seems like an inferior way of writing code.

Re: Comparing Svelte and React

#116

Earlier quoted context omitted.

> even the difference between passing by reference vs value You can only pass by value in JS so maybe that's why. It is a bit confusing because of how objects work that it feels like you are passing by reference. You are passing reference as the value.

When it comes to primitives you can only pass by value, but with objects and arrays you can only pass by reference . And this applies to comparisons too: when comparing objects or arrays you are comparing by reference , not deeply by their inner values. If you want to compare them deeply you have to take some additional steps to make that possible, and all of the different strategies for doing so have different trade…

You don't pass by reference in JS. You pass references by value.

Passing by reference has a well defined meaning in computer language terminology. It means passing something that references the variable outside the function. Something you can't do in JavaScript

    void someFunc(ref int v) {
      v = 456;
    }

    var foo = 123;
    someFunc(foo);
    write(foo);  // output 456
Above we are not passing 123 (the value of foo) into someFumc, we are passing a reference to foo. This is what pass by reference means.

same if foo was reference to an object

    void someFunc(ref Object v) {
      v = someOtherObject;
    }

    var foo = someObject;
    someFunc(foo);
    // foo now refers to someOtherObject
In this impossible in JavaScript. It does not have the concept of pass by reference. It only has pass by value

    function someFunc(v) {
      v = someOtherObject;
    }

    var foo = someObject;
    someFunc(foo);
    // foo still refers to someObject
Above the value of foo, which is a reference to someObject, that value is assigned to v in someFunc. v's value is set to reference someOtherObject. foo's value is still someObject as there is no way to "pass by reference" in JavaScript

Re: Comparing Svelte and React

#117
post #86

Earlier quoted context omitted.

How is Svelte "just JavaScript" when it uses custom templates and file types?

I feel like this "just javascript" trope really needs to die. JSX is not "Just Javascript", and magically reactive `foo = bar` assigments are not "Just Javascript". But frankly, that doesn't really matter one bit anyways; it's fairly nitpicky to object to different control flow syntaxes, when at the end of the day you're just rendering data from a request to screen. I'm sure not many people would be willing to argue…

where do I read about this throwing promises thing?

Re: Comparing Svelte and React

#118
post #115

Earlier quoted context omitted.

IMO, Svelte’s biggest issue is it didn’t come out of FAANG.

biggest issue of Svelte (and vue and others) is that mutable state is marketed as a feature. If you don't like mutable state anyway then it just seems like an inferior way of writing code.

Yes.

To be fair, after looking how the whole Redux story went, I think the mainstream simply wasn't ready for immutable state.

Re: Comparing Svelte and React

#119
I wrote my first decent size Svelte app (with a Rails API app backend) last year: https://www.listenaddict.com/

Of course, what you see is just a tip of the iceberg, having implemented a nice admin and moderator dashboard, keyboard shortcuts, animations, 12 different color themes (in light and dark mode), and more. Svelte just made it all so easy to do. Having done a good bit of React and Angular professionally, and tinkered with Vue, I can safely say (for now) that all I want to do is Svelte. The rest just seem so heavy handed in comparison.

Self promotion: I also run a YouTube channel where I'm slowly building out a Svelte app with Rails API backend. If you're interested in Svelte, please check it out: https://www.youtube.com/user/iamdavidwparker

Re: Comparing Svelte and React

#120

I'm a big fan of Svelte. I've raved about their documentation before, but it bears repeating: this should be the gold standard. You can read it all in a day. There are examples to follow right next to the documentation. Svelte is both succinct and powerful. I find this in contrast to React which is often baffling and incoherent. I say this as someone that has used React professionally for 6 years. They've changed the…

Neither agree or disagree, but just want to say that's exactly how I felt about Angular when React first came out. It wasn't much of a "framework" at all, just an easy way to render onto the DOM from js.

I very much like the idea of compiling code to make direct DOM mutating managable. A very powerful idea regardless of which syntax you end up going with. I wish their website talked more about this instead of having a React comparison on every page.

Post reply on HN