Why I Like Svelte - Svelte Tutorial 0
WebJeda
- Web developer friendly I'm a web developer and I like HTML, CSS, and JavaScript. To be honest, I never really liked any JS framework before because they asked me to learn something new. Sometimes new syntax, sometimes new ways to use the markup so on and so forth.
I'm ok to learn new things but I did not dig deep into any of them because they felt like a deviation from the regular HTML, CSS, and JavaScript that I used everyday.
Eventually, I had to take up React for a project to which I was been a part from a long time. It was kind of forced on to me but I started liking it. I understood the true productivity and simplicity that can be obtained from a JavaScript framework.
But, I did not like how React uses JSX or HTML inside JavaScript. That always felt wrong to me.
Along with all these, I was also trying to learn Vuejs which seemed more like HTML and less like JSX.
I still love Vue for the fact that you can just put a script tag in any HTML app and you can start using Vue. Which is fantastic. This is exacly how we add a Javascript plugin to HTML.
Let's say you are designing a homepage and you want a carousel or slider, you just go to slick carousel page, get the script tag and use it on your website with some initializations. That's it. You can start using it. In that way Vue was revolutionary. For me at least.
I was still into Vue until I watched "Rethinking Reactivity" video on youtube. I'm not sure how I ended up watching that video but I'm glad I watched it.
I still watch it time to time to understand the Genius of Rich Harris. How he looked at these JS frameworks in a different angle and utilized compiler instead of the browser to handle all the logic. And also, How he found a way to truly reactify elements without DOM diffing where you change something in Virtual DOM and compare it with the actual DOM. And then update the difference to the actual DOM.
And in that way - since svelte is truly reactive - he got rid of Virtual DOM completely which is radically different from other frameworks. Because the other frameworks still use Virual DOM which is an overhead.
So Sveltejs was mind blowing for me because finally I found this JavaScript framework that isn't difficult to learn, it uses less number of code to achieve the same thing and the most important of all, spits out a tiny JS file which doesn't need any Runtime environment to run.
That should be enough to be excited about svelte but there are other things I like about Svelte
- You can just write HTML
Svelte is a superset of HTML. I feel like it is HTML but with a lot of enhancements.
Even a paragraph tag works, just like any html file. Creating components and using them is easy.
- Scoped style
Css is localized to a component, doesn't affect other components. It solve ... https://www.youtube.com/watch?v=wY6unLTuMsU
30882869 Bytes