After 7 Years of React.js Love,I tried Svelte and I have to admit Its Awesome
* Pros for svelte
- No Virtual-DOM, so zero tension for immutability and no re-rendering chaos
- Svelte inbuilt store is Awesome!, No need to add Redux every time and Svelte store and $ operator are also reactive so data change is good enough for re-rendering component
- There is no hooks, so It is very easy to separate data layer from component. In react if there is business logic in Hooks then often It is hard to access that from pure function or Utils.
- Web Components!!!, If you have to built developing atomic ui-libs, which is became necessary for big projects then Svelte is very good option. Svelte has inbuilt support to export web-components which can run in any browser without any framework and good thing is svelte is just compiler so it is not shipping its own code and Vite will export only necessary code which is required for running web-component unlike react where each library must require react as a dependency.
- ShadowDOM is also good, css-modules are not required
- React.js with nextjs is almost similar as svelte-kit. Nextjs may have better features, but Svelte-kit is also growing.
* Cons for Svelte - If you are not using tailwindcss then you are going to miss passing className prop from parent to child in svelte - Reactjs has better Community and IDE Support, although my Neovim setup work like charm for Svelte, I still think react will be better for this case
(
10 comments
| 3 points
| on HN
)
even if svelte is better than react (which i'm not conceding yet), the tooling and resources around react are just unmatched. You'd loose so much velocity and/or capability by doing Svelte that you wont be running at all
This is a fair point to bring up and might be the main advantage of React at this point. But as a counterpoint to that, part of the reason that the ecosystem around React is so well-developed is that React itself (in its specific role as a sort of view layer) has like 80,000 libraries and design patterns for lots of necessary tasks like state management. And because React has been around so long, many of these resources and tutorials are out of date or otherwise questionable.
Whereas going into something like Svelte, you know that almost certainly you're going to use the built in stores and it's likely going to work perfectly for the overwhelming majority of common use cases. Does it really matter if the Svelte ecosystem is smaller and less developed if the right way to proceed in virtually any project is much clearer?
React is certainly "safer" in a sense, you're never going to get in trouble with your boss for choosing React, just about anything that you'll ever want to build with React has been proven as workable, you'll always have 18 dozen libraries to solve just about any problem, and you'll always be able to easily hire a pile of developers when needed.
I don't know if there's an objective right answer because every situation is unique and we're sort of dealing with an opinion, but I know which way would increase (this) developer's happiness level.