Introducing Svelte, and Comparing Svelte with React and Vue
Publikováno: 4.11.2021
Josh Collingsworth is clearly a big fan of Svelte, so while this is a fun and useful comparison article, it’s here to crown Svelte the winner all the way through.
A few things I find compelling:
One of the
…
The post Introducing Svelte, and Comparing Svelte with React and Vue appeared first on CSS-Tricks. You can support CSS-Tricks by being an MVP Supporter.
Josh Collingsworth is clearly a big fan of Svelte, so while this is a fun and useful comparison article, it’s here to crown Svelte the winner all the way through.
A few things I find compelling:
One of the things I like most about Svelte is its HTML-first philosophy. With few exceptions, Svelte code is entirely browser-readable HTML and JavaScript. In fact, technically, you could call Svelte code as a small superset of HTML.
And:
Svelte is reactive by default. This means when a variable is reassigned, every place it’s used or referenced also updates automatically. (React and Vue both require you to explicitly initialize reactive variables.)
I do find the component format nice to look at, like how you just write HTML. You don’t even need a <template>
around it, or to return
anything. I imagine Astro took inspiration from this in how you can also just chuck a <style>
tag in there and scope styles if you want. But I think I prefer how the “fenced” JavaScript at the top only runs during the build by default.
P.S. I really like Josh’s header/footer random square motif so I tried to reverse engineer it:
To Shared Link — Permalink on CSS-Tricks
The post Introducing Svelte, and Comparing Svelte with React and Vue appeared first on CSS-Tricks. You can support CSS-Tricks by being an MVP Supporter.