2 ms·
> Svelte components compile to vanilla javascript plus a small runtime Same could be said of React though. React components are literally just plain JavaScript
by wyqydsyq 7y ago
> Svelte components compile to vanilla javascript plus a small runtime
Same could be said of React though. React components are literally just plain JavaScript functions which return VDOM nodes that get diffed and applied to the DOM by the runtime library.
The only objective advantage I see to Svelte is it's tiny footprint, which if you really need you can already get by using Preact (3kb vs Svelte's 3.5kb) without having to learn yet-another-completely-arbitrary-templating-language to no benefit.
- pests 7y agoSvelte is actually quite a bit different. Quoting a random section from their docs "[Svelte is a] compiler that knows at build time how things could change in your app, rather than waiting to do the work at run time" My point being there is a large amount of compile time code transformation at build time. The run time is not so much a framework as a library like libc. In Svelte when you update state there is no virtual dom, dom diffing, fibers, or anything. It would have been compiled into a direct dom update of anything depending on it. It's no longer a Svelte app just vanillajs. There are some details or course but it's a different paradigm than to react or other modern UI frameworks.