Interest is another thing, but interest alone doesn't mean much.
Personally, I love Svelte and am using it everyday (for at least a year). I hope to share V2 of the social network In building with it here soon.
I would recommend anyone interested in Svelte to check out this channel, people are really nice and helpful there.
But now it's pretty common to be using or considering Svelte amongst the same folk that were the first to try Backbone, Angular and React back when they were the new framework of the day.
You can ask a question of StackOverflow and get an answer.
<script>
let count = 0;
$: doubled = count * 2;
</script>
<p>{count} doubled is {doubled}</p>
I'd be very confused if `doubled` were to somehow automatically update any time the value of `count` changes, if merely defined as a standard variable (e.g. `let doubled = count * 2;`). This would totally break my mental programming model.I'm not sure what the parent commenter had in mind as an alternative, or how it could be made simpler or terser.
Svelte and React makes different tradeoffs in how they expect developers to deal with this.
Personally I think maybe Svelte makes a better tradeoff. I've seen so many people make variables instead of using useState, etc… because that's the kind of thinking they're used to.
In Svelte that would simply work for the simple cases, but you'd have to use $: someVar for the more complex cases. I think requiring having to deal with that complexity only when you need it is a more reasonable way to do it compared to React.
Same size of the project in React will take 100Mb of drive space, and something more serious in industrial environment goes easily over 1Gb of disk storage, although I love React I find that insane. Even "Hello World" build of React will range between 2MB and xxMb depending on config.
If you think reactivity is the frameworks’ job I see no reason to praise React at all - especially with hooks you will be manually handling dependencies and updates everywhere, feels like a huge step back.
while react, vue and angular being mainstream, they are also being used by folks who may not be fully satisfied, but can't switch away to other tech
Somehow Svelte doesn't sit well with me. Anti virtual dom advocacy turns me away. The way they sell Svelte is thoroughly antagonistic.
I tried to read the documentation but I'm suspicious about HTML that is not HTML, and JavaScript that is not JavaScript and CSS that's not CSS. "It's reactive." doesn't instill any confidence in me that state manegent won't end up in tangled mess in my app.
I was checking out benchmarks to see if Svelte is actually as fast as they claim and it is faster but not faster then some of their more low key competition.
https://www.freecodecamp.org/news/a-realworld-comparison-of-...
While checking out benchmarks I noticed some framework called AppRun.
I started looking at their docs. Reading through that was a breeze. Very simple model of operation, state => view. Everything (also state modifications) goes through events. You can use it as SPA or just enhace your existing webpage with few AppRun components. You can use JSX if you like it or not. Languages don't have any custom extensions. It's just JS, CSS, HTML (JSX) (with single exception of optional custom directives).
You can use TypeScript, inspect state with Redux dev tools. And everything is faster and requires less code than Svelte.
https://medium.com/@yiyisun/i-also-created-the-exact-same-ap...
> Languages don’t have any custom extensions. It’s just ... JSX
I have news for you, JSX is a custom language extension, and a pretty deep one. I hear this a lot from React devs and it always irks me.
If anything, Svelte is the closest to writing pure JS, HTML and CSS you’ll find, outside of hybrid solutions like Alpine. You can literally write a div tag, plain styles, and a plain function and it will all work with zero framework boilerplate.
But back to the first point - why even bother to waste time judging and comparing? Just build something with it and see what the experience is like. That’s what matters.
JSX in AppRun is optional. You can use lithtml or just html. https://apprun.js.org/docs/#/06-view-patterns
I'm not React dev although my last job was in React, previous was in Angular.js, the one before that in backbone.js and the one before that in jQuery, and the one before that in IE5.5 raw JavaScript.
JSX is pretty established and focused (optional) language extension which I was initially cautious about as well. Svelte extensions feel for me a bit more adhoc and mandatory.
I'm judging and comparing because I'm interested in frameworks and templating engines. Building stuff to judge something is fine but I have no need to build anything at the moment so I prefer now reading the code of stuff that other people have built and consider if it's a pleasant read for me. Svelte isn't same way angular.js wasn't. AppRun is, possibly even more than React was (at least the React before hooks).
EDIT
Hyperapp looks similar but as far as I can tell it doesn't have event bus.
I worked with one large project (google maps competitor) in raw JS that used event bus and it was really amazing how much you could understand about it just hooking yourself to the bus and inspecting all events that go through there, knowing that nothing happens behind your back.
So that's a clear win for me in AppRun vs hyperapp.
Although AppRun seems to have one event bus per component so hooking up to all of them might require a bit of effort and tickery.
Another thing is stateful components. Hyperapp doesn't have clear way of making stateful components. People are just winging it in various ways.
The problem is, I need a comprehensive toolkit like PrimeNG or KendoUI. Didn't really find anything compelling for Svelte yet.
When evaluating the actual numbers:
-Svelte has the most people not interested, but the least with people saying "will not use"
-React and Vue.js has almost 5x and 3x as many people saying they would use it again
-Svelte's high ranking comes from people who are interested but haven't used it at 10k people, providing it a high positive score, but less materiel interest.
-Svelte is still very unknown compared to React and Vue
Only time will tell where Svelte will end up on the js framework ladder, but the high ranking of Svelte seems to be attributed to interest and not actual use.
2020 numbers from the article:
-React: Would not use 2154; Not interested 1794; Would use again 15071; Interested 2490; Never heard 19
-Vue.js: Would not use 1574; Not interested 4070; Would use again 9029; Interested 6781; Never heard 195
-Svelete: Would not use 351; Not interested 5308; Would use again 2810; Interested 10308; Never heard 2954
I'll take the time to plug my side-project here: https://www.listenaddict.com/
Built with Sapper (Svelte) and Tailwind on the frontend, and Rails API as the backend. Total frontend load is less than 95kb (transferred, uncached).
I've been incredibly pleased. I've done a lot of AngularJS and React, and a fair bit of Vue and a little bit of Angular, and compared to those, it's been fantastic. Sure, the ecosystem is missing some things here and there, but all the built-in things more than make up for it. The documentation is incredibly simple to go through, and you can read everything in half a day (plus do the tutorial).
For future projects, I don't expect to or have a reason to go back to React (or Vue or...) unless something huge happens.
Svelte feels closer to the bare JS, and I'm learning a lot of what used to be abstracted on Vue. The community resources and related open-source packages are certainly not as comprehensive as React or Vue, but I think it's coming along.
Excited for svelte-kit to be released and will transition my project to it.
Earlier we were using PHP to power our website but after shifting to svelte we saw an approx 3x increament in terms of retention and order placement.
- Svelte embraces HTML and CSS as-is (no JSX, yeah!)
- Svelte reduces boilerplate and is easy to start with
- Svelte is elegant and needs less LoC
Svelte is great and will inspire a lot of other frameworks. That seems to be mirrored in the scores shown at StateOfJs.
Hopefully there will be more institutions to help Svelte with professional adoption.