Could someone give a one or two sentence explanation of why I would want to use Svelte over something like React? I have heard it is "better", but have never understood why.
Svelte 4
41–50 of 227 posts
Re: Svelte 4
#42Could someone give a one or two sentence explanation of why I would want to use Svelte over something like React? I have heard it is "better", but have never understood why.
Most folks would probably say "it's faster" but I think the real upside of using Svelte is the DX. It's just massively simpler and way easier to be productive.
Re: Svelte 4
#43Could someone give a one or two sentence explanation of why I would want to use Svelte over something like React? I have heard it is "better", but have never understood why.
Massive reduction in boilerplate. As someone who attempted to onboard onto both react and svelte for a couple days each, react continued to feel hyper unintuitive with a bunch of magic constructs. Svelte felt like I could guess what would work and it just did. Caveat: since I went react -> svelte it's possible I was just warmed up to JS by that point
Re: Svelte 4
#44Could someone give a one or two sentence explanation of why I would want to use Svelte over something like React? I have heard it is "better", but have never understood why.
Re: Svelte 4
#45Earlier quoted context omitted.
Less code as everyone else mentioned, single file components (CSS is inside your .svelte files too, and isolated automatically), and a general feeling of on railsness that React for me lacked. State in Svelte goes in stores. State in react seems to go in one of eighteen different mechanisms, which all begin with a 45 minute video of the author’s opinions about the true nature of reactive programming, when all I want…
> State in Svelte goes in stores. State in react seems to go in one of eighteen different mechanisms, which all begin with a 45 minute video of the author’s opinions about the true nature of reactive programming, when all I want to do is store a string. So... useState? :) Of course then I got to thinking about how I'd answer the question "How can I put make that useState value accessible at different points in the co…
It's really quite simple and elegant. Svelte's model would likely be more complex tbh.
Re: Svelte 4
#46Re: Svelte 4
#47Re: Svelte 4
#48Could someone give a one or two sentence explanation of why I would want to use Svelte over something like React? I have heard it is "better", but have never understood why.
This is always a personal judgement, but here's my personal list: - I find it so much easier to understand. I don't have to useState/useEffect/whatever, I just assign variables and the component re-renders the relevant parts whenever I assign a new value. - Styling is "just" CSS. No messing around with CSS-in-JS libraries and their various ways of being invoked. The CSS is automatically scoped to your component witho…
What's frustrating for me is that I'm so used to thinking in hooks that when I first gave Svelte a try, it didn't click. And I knew that was wrong, lol. The release of Svelte 4 is good timing, I might have a use-case at work for a small project to try it out, so I'm going to give it another shot.
Re: Svelte 4
#49> The number of dependencies in Svelte has been greatly reduced from 61 down to 16 Adore this. Would love to see more JS frameworks reduce their dependency trees.
I understand this thought for external dependencies, but dependencies also includes internal ones, which I don't see a reason to reduce. Modularity and re-usability of individual pieces of code are a good sign for me.
Re: Svelte 4
#50Earlier quoted context omitted.
Svelte tries to improve upon the relatively complex/heavyweight runtime of something like React by shifting as much of that complexity to the build step as possible. It also takes a more "batteries-included" approach compared to React by including some opinionated features like state management, animation, transitions and the like. I haven't dug too deeply into Svelte because last I checked it didn't play particularl…
One of the things released today was dedicated documentation for TypeScript: https://svelte.dev/docs/typescript . The site was also updated today to include a JS/TS toggle so that you can see all the examples written in TypeScript if you prefer it to JS. I'm not sure how long ago you tried or what issues you ran into, but hopefully this will help with getting started with Svelte and TypeScript much more easily.
Yeah that toggle has been on there for months now actually