DEV Community

Discussion on: Here's why I Recommend Svelte To Every New Web Developer In 2022

Collapse
peerreynders profile image
peerreynders • Edited on

Please do yourself a favour and read:

the return to the server?!?

Frameworks designed around the Client-side Rendering use case are "Gen 2" and therefore on the verge of becoming legacy technology especially if they have painted themselves into a corner with some of their core design constraints.

"Gen 3" technology makes SSR a primary design concern; i.e. it isn't just added after the fact.

Now due to the enterprise investment Angular will stick around just like COBOL for internal applications, React has a (comparatively) massive install base already, while Vue needs to get past its current version 2 vs 3 fragmentation.

The legacy of those three will likely stick around for some time to come regardless of how well they adapt to the coming Gen 3 transition.

The rest will have to fight it out in terms of who can best adapt to the coming Gen 3 transition by appealing to the "Gen 2" familiarity of application maintainers while emerging Gen 3 solutions don't run circles around them.

Now I took a good look at Svelte even before most people were willing to do so due to lack of TypeScript support at the time. I liked what I saw and I agree that after learning HTML/CSS first, Svelte as a first framework is almost a natural transition.

However in it's design it still is primarily a CSR focused framework and more importantly it is very component centric (which ironically a VDOM based framework like Inferno can get away with and still be more performant). So while the framework may "compile away", the components don't and that imposes a certain rigidity on its approach—a logical consequence of a deliberately chosen trade-off.

Now I'm sure Svelte has made great strides since then, especially in regards to SvelteKit.

But one cannot ignore what else is going on.

Meta-frameworks like Astro make it possible to reuse your current (Gen 2) components inside a server-side routed application when you realize maybe you don't need that SPA. Once you're inside that environment and it turns out that there are some parts that are too heavy for what they do, you can gradually migrate over to a leaner framework perhaps even Svelte.

But now take into account that React is pretty much the incumbent technology when it comes to CSR and that a large portion of that community are JSX devotees, unwilling to give up "declarative UI" and "just JavaScript".

Then in the most recent State of JavaScript 2021 SolidJS came out of nowhere (which clearly could just be the result of an extremely vocal and active community however small it may be at the moment).

If you look at SolidJS it should become immediately apparent that it has "React-appeal" even though its components are setup functions, not render functions simply because it maintains the "declarative UI" and "just JavaScript" spirit (which could count against it for non-React developers). So if a React developer is going to migrate (for whatever reason) SolidJS has the immediate appeal of superficial familiarity.

And in my personal judgement SolidJS is much less constrained than Svelte which can give rise to novel architectural styles that go beyond components given that its finest level of composable granularity are the reactive primitives, not components (conceivably one could do something similar with Svelte Stores but those are simply not as convenient as "reactive statements" which Svelte developers will prefer to use and it still doesn't get rid of the design-time component boundaries at runtime).

So will SolidJS surpass Svelte at some point?

I have no way of knowing.

All I can see is that the incumbents are here to stay at least for a while; in the meantime the rest is in for a volatile ride while Gen 3 settles in.

Collapse
hnrq profile image
Henrique Ramos

Gotta agree on the Solid point. As a React developer, SolidJS seems much more natural than Svelte. Also, having to learn "SvelteScript" worries me a bit, even though Svelte's features play around with things that JS already has.

Collapse
peerreynders profile image
peerreynders • Edited on

Don't get me wrong, the first hurdle for React devs is the whole render (React) vs. setup (SolidJS) function as a component thing:

And depending on where you are coming from the reactive primitives may take some getting used to (I was already somewhat acclimatized due to my RxJS, Vue, and Svelte exposure) but none of that is insurmountable.

Though apparently some React devs are allergic to the <Show /> and <For /> components (I think they're an improvement as I do tend towards a template style).

Interestingly Rich Harris ended up explaining how SolidJS works…

Collapse
hr21don profile image
Helitha Rupasinghe Author

Thank you for posting this! 👍