Looking at Svelte it really looks promising and I can see why many people will learn it and use it in the future.
I just see a lot of issues that are quirky to deal with in React, like data fetching in components, are solved more elegantly in Svelte 😎.
If you want to learn about all the things you need to handle when doing data fetching in React take a look at:
Correctly handling async/await in React components
Correctly handling async/await in React components - Part 2
Now comparing the React way of doing it to Svelte - I think the Svelte approach is much nicer:
Why you should learn Svelte
You should learn Svelte not because it's the new cool kid around the block, but because it adds new paradigm shifts to frontend development, that can certainly help you:
- Less boilerplate code due to handling state and reactivity in an easy way ⭐
- Global state management built in ⭐
- No Virtual DOM means faster renders due to avoiding not needed CPU cycles ⭐
- Heavy lifting done at compile step means smaller bundles and faster code ⭐
- Built in auto-scoped CSS in JS and animations ⭐
So it has 5 stars from me, what do you think?
If you like this article, chances are you will also enjoy what I post on Twitter. 🔥
Oldest comments (6)
You should check out the excellent RiotJS - it's very similar and predates Svelte by years
Will check it out.
After somewhat messy setup of redux I would say Svelte's state management is a godsend. The only thing is when tech lead don't pick it up, then less companies use it for serious projects, then less serious showcases to convince people to pick it up. Many might think: why should I bother if I can't find a job learning it?
We still need to give it some time, but I think it will be a big thing in the future! It has nice things that we miss in React.
Yeah... I fell in love with it when I wanted to pick a framework to learn.. but I ended up learning React first in order to be job-ready. Now after building some stuff with React I come back to pick Svelte again and am learning to build sth more serious. Like a market-ready MVP side project.