16 ms·
Migrating from Vue 2 to Svelte
- EvanYou 4y agoAuthor of Vue here - as many have pointed out, the article contains a number of comparisons that are incorrect. I have written a post clarifying them: https://blog.vuejs.org/posts/on-migration.html https://blog.vuejs.org/posts/on-migration.html
- wetpaws 4y agoMigrating from svelte to <next flavor of the month> when
- simlevesque 4y agoWhen the CTO tries to ride waves.
- davidkuennen 4y agoThis. For me product velocity and producing value fast for customers is always top priority. Migrating from state of the art framework #1 to state of the art framework #2 seems wild.
- karmasimida 4y agoMeanwhile React will continue succeeding the test of time
- swyx 4y agoi just think vercel made a very smart move hedging their bets among the big 4 major frameworks, so no matter what wins they still win
- bavell 4y agoI learned React almost a decade ago and never looked back. Multiple SaaS apps and dozens of personal projects later, I feel no need to reach for anything else.
- exclusiv 4y agoI like React and I'll admit that I resisted React at first, mainly due to JSX and workflow purposes. We had teams that could do CSS/HTML very well and those that were more capable in JS. There was a gap in skills. And taking the design files into HTML/CSS, testing the bulk of it and THEN adding dynamic functionality and JS was a good flow. This was also many years ago, where we had - let's build apps mainly with HTML/CSS and sprinkle in some JS framework sugar and dynamic capability on the client side. Ok, Angular/Ember and then Vue worked VERY well. We made a hop from jQuery to more sophistication but still easy to read and develop compelling and maintainable, interactive frontends. Then we did SPAs which worked well for a few things but were vastly oversold. React came along which was nice, but early on, it was not needed for many projects even though many devs started implementing it. We had a demand for more rich web apps and they got MORE complex and dynamic. We decided, maybe we shouldn't sprinkle in all these sugary JS framework tags and corresponding logic in our HTML. Then we had a ton more university-educated programmers entering the frontend scene that used to just be comprised of a megaton of jQuery heroes (no offense, they got shit done and went out to lunch most days while the more sophisticated frontend devs went hardcore on semantic HTML/CSS, VanillaJS, spending countless hours on browser bugs and QA cycles and using divs to render tabular data for fun/ego?). We also got more interest in React from non full-time frontend devs (ex: fullstack and even backend devs) that were like, hey building frontend doesn't suck like it used to in VanillaJS! Count me in! Coupled with the Stackoverflow copy-paste dev era and the nightmarish third party library upgrade scenarios... now we have a TON of shitty React codebases and people have, and will, migrate away from them. This cycle I'm describing gives rise to challengers like Svelte. I like React (and React Native), but the many codebases I've inherited have not been good. In fact, I've probably inherited as many decent React codebases as decent jQuery codebases but what does that say? Not much because I haven't inherited many good examples of either. I'll still choose inheriting a shitty React project over a shitty jQuery project any day. Great progress has been made (although you could argue much of the progress was in cross-browser standards and advancements in browser technology). But I still feel like the truth that everything that is old becomes new again cannot be avoided. And in that - it's web components and/or more HTML sprinkled JS frameworks for the win to me. I haven't used Svelte, although some on my team like it, but it looks like a return to a get-shit-done dynamic websites/apps framework. And I'll likely still continue using React for larger, more rich and dynamic apps that require a larger dev team.
- jmkni 4y agoAs will Angular lol
- veidelis 4y agoReact is on the downfall because of NON-functional hooks. API becoming too large and the direction is unclear - at least to me.
- reducesuffering 4y agoI don't see what metric would make you think React is on the downfall. https://insights.stackoverflow.com/trends?tags=reactjs%2Cvue.js%2Cvuejs3 https://insights.stackoverflow.com/trends?tags=reactjs%2Cvue... https://npmtrends.com/react-vs-svelte-vs-vue https://npmtrends.com/react-vs-svelte-vs-vue
- timeon 4y agoIs six years old framework "flavor of the month"?
- simlevesque 4y agoNot sure what they mean by "typed events: vue 3: no". It's possible, I did it today. Here's the doc: - Typed component emits: https://vuejs.org/guide/typescript/composition-api.html#typing-component-emits https://vuejs.org/guide/typescript/composition-api.html#typi... - Typing event handlers: https://vuejs.org/guide/typescript/composition-api.html#typing-event-handlers https://vuejs.org/guide/typescript/composition-api.html#typi...
- heisenbit 4y agoAnd the discussion of store for Vue neglected pinia which is de-facto the store.
- simlevesque 4y agoPersonally, after going all in with Pinia, I went back to no store. I just use refs and computeds exported from files. I have a dummy pinia store loading all of them to provide a basic devtools ui.
- allanrbo 4y agoIt seems worrisome that front end frameworks needs to be changed after just two years of use. Glad I'm not working with front end...
- jdlshore 4y agoI see it as more a lack of developer discipline than a need—or, more charitably, developers choosing to prioritize things other than longevity. You can certainly choose to develop in a way that's more stable.
- rob74 4y agoAs another comment mentioned, migrating from Vue 2 to Vue 3 is mostly trivial, so this is probably just a case of preferring the new shiny over the old formerly shiny now slightly tarnished...
- timeon 4y agoI agree but it is not really 'new shiny'. I went from Vue2 to Svelte long time ago. Svelte 1 is from 2016.
- s-lambert 4y agoReact is almost 10 years old, if you used React in the last few years you haven't really been changing more than the average backend. The "frontend changes so often" meme made sense years ago but doesn't seem to be that different than backend nowadays. I mean in the last ~10 years we had the new hotness of moving from cloud hosted servers -> docker images -> kubernetes, C# made a massive move when going to .net core, Java actually updates frequently now, etc. Frontend moves a bit faster than backend but if you picked React/TypeScript 5 years ago, you're probably still using them.
- meribold 4y agoBut if you picked C and Unix 50 years ago…
- 4y ago
- lmiller1990 4y agoRe events - You can type events in Vue with `defineEmits`: https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits https://vuejs.org/api/sfc-script-setup.html#defineprops-defi... Re global enums - I'm not sure what the author means about global enums - anything imported into your Vue file can be used in the `<template>`. Re styles - Style is automatically scoped in Vue SFC files, too - I believe it was the first component framework to do this. This article and migration seems not very thoroughly researched - seems the author just wants a reason to rewrite the front-end.
- simlevesque 4y agoThat's my impression too.
- Elte 4y agoI've got a couple of templates where I've aliased the value of a TypeScript enum into a local variable before using it in the template, so I'm pretty certain at that point I was unable to use the value of the enum directly (that's also how I remember it). However, I just tried it and...it seems to just work now. So thanks for making me revisit that :D.
- deleted 4y ago[deleted]
- Semaphor 4y agoedit: Disregard, this is wrong. ----- I agree with the rest, but how do you use imported TS enums in your template? Something like this being impossible is regularly a pain point for me: slotProps.data.type === ArticleTypes.SomeType
- Pokerkoffer 4y agoStore a reference to the enum locally then you can use it in templates
- deleted 4y ago
- snowl 4y agoStill don't understand why people prefer magic templated front-end frameworks. Reading non-standard HTML just sucks. What even is "$:" or why does Vue require non-standard javascript ref("") objects...
- llanowarelves 4y agoI know you're probably asking it only rhetorically, but it's the way to mark something as reactive for the Svelte "compiler", cleverly using the existing JS label syntax.[1] [1]https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- tills13 4y ago"cleverly"
- doctor_eval 4y agoIt is clever. It’s just a named label with the name “$”. It’s perfectly standard JavaScript, and it’s super easy to remember.
- mejutoco 4y agoI like how jquery used $ to namespace all methods and now svelte does not repeat, but rhymes.
- swyx 4y agoand JSX somehow gets your blessing? let he who is without sin…
- jbergens 4y agoI'm not the one who wrote above but I see JSX as having fewer magic things than all other template languages I've seen. Take a look at Angular to see some complicated syntaxes examples. Vue and Svelte are better but, IMHO, not as easy as JSX.
- whalesalad 4y agoI’ve been so happy with Vue (2 or 3), I can’t think of a compelling reason to leave. The 2->3 migration is also trivial aside from any third party libs that don’t work. It’s really not a big lift. You can transition without going all-in on the composition API. The diff on a big project is very small.
- andrewflnr 4y agoTrivial is not the word I would use. My 2 -> 3 migration is a currently ongoing nightmare, even with the compat lib. I was using vue-class-component with typescript, which apparently... just doesn't work at all with Vue 3? And this isn't really documented, so I basically spent today digging around in Vue's guts with the debugger to prove there was no good way to salvage it for my code, I really just needed to rip it out to have a chance of running it at all. Hopefully that was the worst of it, but Vuex is still acting up. Thank god for VCS or this would be terrifying.
- nov21b 4y agoI was in a similar situation, heavy class component based TypeScript Vue 2 project. Vetur was still the default vscode extension and slow. It was either a big rewrite to Vue 3 or a big rewrite to React for me. I switched to React+MobX and have no regrets.
- andrewflnr 4y agoI mean, the class component thing was mostly syntactic, for what it's worth, once I figured out that was the only way. Drudgery, but not a real threat of failure.
- Hawxy 4y ago> vue-class-component with typescript I was using this but immediately saw the writing on the wall as soon as the Composition API came out with its far superior typescript support. Converted our greenfield Vue 2 app over to the new API within a few weeks which turned out to be the correct decision. Unfortunately, unless you were following Vue development very closely this would've slid by. Are you sure vue-class-component 8.0.0 RC1 doesn't work? I see it was in development for v3 before being discontinued.
- zenbai 4y agoSolid JS is what I would have chosen. Not sure if they considered it. Best performance and dev experience with least 'magic' of all frameworks I've tried.
- hakre 4y agoAt least it was on top within the timeline-strings-percentage-bubbles graphic. And as the latest and greatest omnipotent entry in it, so my guess would be theirs authors were aware of it. /edit: thanks for pointing me to solid, it shined a lot of light to me in context of the article.
- swyx 4y agowhat do you like about the dev experience? i have a hard time seeing solid as something more than “react but faster and slightly less annoying”. still doesnt have scoped styles, animation, state mgmt, head management, etc out of the box, all minimum things i look for to be productive
- jakelazaroff 4y agoThey recently released a beta of SolidStart, their answer to Next.js/SvelteKit/Remix, etc, and I’ve been really liking it. A lot of good ideas pulled from the other frameworks. https://www.solidjs.com/blog/introducing-solidstart https://www.solidjs.com/blog/introducing-solidstart
- swyx 4y agocool. any blessed scoped styling solution or is it the usual wild west?
- hakre 4y agowild west? as far as CSS is concerned the cascade should be well known and for scoping its (in order of preference): 1. user 2. client 3. document and within document its in "components", but those are unknown from the start so we defer the details (which must not but can lead to "wild west"). programming is hard, thought. would love to have that holy grail solved, too (apart from the famous three column layout).
- zccm 4y agoIt seems that the author found many wrong resources; Nuxt 3 just became stable and it's using vite also.
- beau_g 4y agoHas anyone worked on a very large Svelte project yet? I work on a large React app in real life, but have been learning Svelte in my off time - there are some nice aspects like the out of the box state management, the syntax and structure is a bit easier to learn than React, but my intuition is a Svelte project would become unwieldy for a very complex app (React class components that are hundreds of lines long with dozens of props/local states are easy for me to read/digest but maybe I'm just used to it, it just doesn't feel to me like this would stay well organized in a .svelte file).
- engido9740 4y agoNot sure if this satisfies your question, but I'm the creator of the Skeleton UI library: https://github.com/skeletonlabs/skeleton https://github.com/skeletonlabs/skeleton Our documentation is all Svelte and dogfoods our own UI components. We've got dozens of pages and components here. Scale is from small to large. All open source so give it a go. I come from a background in Angular over the last 10 years. Built several large SaaS apps and admin systems. I'd have no hesitation using Svelte in it's stead. In fact I'd probably get it done in half the time and half the code.
- swyx 4y agonotable companies now using svelte not just for internal apps but customer facing, critical stuff: huggingface (for everything, including gradio), alaska airlines (entire customer flow), razorpay (payment dialogs), schneider electric (many things), ikea (ecomm experience), riot games (league of legends client), Brave (search page), Square (developer portal), several YC startups, and basically every notable data journalism outlet on the planet (Bloomberg, the Economist, Reuters, Les Echos, german and japanese publications, pudding.cool, and of course the NYT)
- robin_reala 4y agoIKEA uses Svelte in a couple of places, but we’re majority React (mostly server-rendered) for customer facing pages.
- spuz 4y ago
- yewenjie 4y agoOne huge thing that I feel nobody talks about about Svelte is that there is no easy way to pass components as props. Sure, there is slots and svelte:component but the ergonomics just don't match.
- swyx 4y agodeleted: misread comment
- dmitriid 4y agoThey weren't talking about web components.
- laszlokorte 4y agoI see that as an advantage. Everytime I see components passed as props or a callback passed as child in react I regard it as a big red flag that something is wrong with the architecture of either the app or react itself.
- richeyryan 4y agoIt's funny; I often see it the opposite way. Passing components as props enables inversion of control and usually helps split responsibilities up more easily and generally avoids prop drilling or super components that do everything.
- laszlokorte 4y agoYeah from a semantic standpoint it makes kind of sense sometimes but it just shows that jsx/xml is not the right abstraction level for the problem at hand. If you compare xml style syntax to s-expressions there is a clear distinction between child nodes and attributes (a "bi-partite tree", not sure if the term exists). For markup like html where the child-data is the content and the attributes are meta-level annotations this makes sense. Even when looking at guidelikes for "how to design an xml schema/doctype" the responses are often like "use child elements for alle business data and attributes only for technical meta-data". So from syntactical perspective there is a clear distinction between attributes and child elements. The main one I would say is that attributes are limited in the sub-structure they can contain (only primitive types or space separated lists). The way react adopted the html/xml like syntax for the creation of javascript objects to allow the declaration of DOM nodes in a nicer way. On top of that react allows the creation of custom elements as functions and allows their usage via the same xml-like syntax. But now as soon as these custom components have more complicated dependencies between each other the xml syntax gets (imo) misused as a poor dependency-injection layer. It's only possible because JSX allows for non-primitive attribute values and it sticks out like like a sore thumb because the semantics do not match the syntax (like defining a "+" operator that is not commutative). In my opinion a better way would be curry the component creation or to introduce a real DI-layer for component configuration that is then used to load fully configured components that can then simply be composed in jsx.
- swyx 4y agoechos many of the same things i loved about svelte when i got involved in 2019: https://www.swyx.io/svelte-why https://www.swyx.io/svelte-why people always call out the small community to be a downside, so a few of us started Svelte Society to fix that (very humble numbers compared to react, Rethinking Reactivity is probably the best starting point for most https://youtu.be/AdNJ3fydeao https://youtu.be/AdNJ3fydeao). i actually think theres a “be careful what you wish for” aspect to this, svelte’s community is super enjoyable now BECAUSE it is small and many come to it as a second framework; so are less religious and more intentional about their tech choices. notable companies now using svelte not just for internal apps but customer facing, critical stuff: huggingface (for everything, including gradio), alaska airlines (entire customer flow), razorpay (payment dialogs), schneider electric (many things), ikea (ecomm experience), riot games (league of legends client), Brave (search page), Square (developer portal), several YC startups, and basically every notable data journalism outlet on the planet (Bloomberg, the Economist, Reuters, Les Echos, german and japanese publications, pudding.cool, and of course the NYT) https://twitter.com/sveltesociety/status/1260209026563858432 https://twitter.com/sveltesociety/status/1260209026563858432 sveltekit 1.0 is also frequently called out as an adoption barrier but.. well.. stay tuned (on the order of weeks not years)
- esperent 4y ago> so are less religious and more intentional about their tech choices. The sentence I would use is "less pragmatic and more interested in hacking than being productive". I know people like to dump React devs for being fanatics and I have encountered some of those people... Like, 2 maybe. The rest of us use React because we want a battle tested framework with a huge community. I don't want to hack around with the cool new framework. I don't find frameworks exciting. I want to build stuff that I do find exciting and I want the framework to be in the background supporting that. I want to be able to find support when I need it and high quality prebuilt extensions for as much of the functionality my app needs as possible so that I'm not spending my days rebuilding basic components. That's why I choose React.
- richeyryan 4y agoI find a lot of Svelte users are pretty religious and hysterically anti-React. When the first version of Svelte Query was announced, people were trashing the API because it looked like hooks and "you don't need those in Svelte", concluding the library must be useless. There's a lot of the "Svelte is the one true way" talk, similar to when Vue was the main alternative to React. The core team seem very reasonable but I think the community has some maturing to do.
- sli 4y agoArticles like this make me wish Elm was still under active development to smooth out its pain points and also not so weirdly hostile towards forks.
- thangngoc89 4y agoI don’t follow Elm development. Do you have any links regarding why the development has been stopped?
- cardanome 4y agoIt has not. Elm just has relatively slow release schedule with the last release being three years ago and some people don't like that. Also the developer has requested that forks are not be called Elm to avoid confusion which some people consider "hostile against forks". There are some projects that have forked Elm.
- the_gipsy 4y agoYou can still use Elm of course. It just has the exact opposite energy as todays.js hottest framework.
- fenomas 4y agoSome months ago I did the same thing as TFA - took a look at Vue3 and decided to change my main project's UI from Vue2 to svelte. So far I've been really happy with it. In my case the big motivator was that with Vue, whenever I worked on my UI code I found I spent most of my time thinking about Vue and not about the UI. I think the key issue was that Vue seems to offer several different abstractions for each of the things it does, so there's generally lots of different ways you could architect any one thing - e.g. how to make a piece of state inside one component accessible from another. Then when I saw Vue3 was adding a new, apparently separate way of doing things (the composition API), but also not deprecating any current abstractions, that was what specifically made me start looking for alternatives. In contrast I've found svelte less mature (and I've had to work around some bugs), but it's been infinitely easier to work with. Svelte basically just has One Magical Thing, and otherwise everything is plain JS (or at least looks like plain JS). So there's nothing to re-learn when I come back to the UI after not touching it for a month, and I don't really find myself thinking about any svelte-specific details when deciding how to architect each component or piece of state. I'm only using a small subset of each library (e.g. I don't use routing or SSR), so YMMV. But so far I'm really happy I switched, and my UI code has gotten smaller and cleaner.
- _s_a_m_ 4y agoI find your points rather weird. > e.g. how to make a piece of state inside one component accessible from another. That is logically the same with every component framework, there is only one correct way to design it, flowing inside data are props, outgoing data are events. Was always the same. > Then when I saw Vue3 was adding a new, apparently separate way of > doing things (the composition API), but also not deprecating any > current abstractions, that was what specifically made me start > looking for alternatives. How does this makes any sense? There is no need to deprecate the component declaration cause of the way it works. Instead of exporting a native JS Object you just use defineComponent({...}) to get type annotations, that it.
- KyeRussell 4y agoI’m kinda confused by this and your other replies in this thread. You seem to be defending Vue, specifically Vue 2, in almost a drive by fashion. You don’t seem to be considering any of the points actually being made. No bystander is interested in hearing the drive by argument of someone without an open mind.
- hatch_q 4y agoI'm missing the raw numbers. Increased performance? Faster code execution? By how much? I'm sure Svelte is faster, but if we're talking 10% improvement it doesn't really matter. Additionally... {@html Prism.highlight(code, Prism.languages[lang], lang) } looks very unsafe to me. (Vue example has the exact same problem)
- swyx 4y agoi dont understand, you’d have to do the same in react? mostly this code injection comes from trusted sources like your CMS. if you’re displaying arbitrary user input then yeah better sanitize it but thats a problem common to all frameworks react included as for perf i mean the main thing is “are you downloading 100kb just for the framework” whereas many svelte apps come in under 10kb. beyond that agree it doesnt really matter
- Existenceblinks 4y agoIt's 136.4kB minified (react+react-dom), for a zero app is crazy. The app size that will justify 136.4kB is probably 700kB which is 836.3kB total, is also crazy. So no hello world argument because it sucks (in engineering metrics) at all range of apps. According to https://web.dev/optimizing-content-efficiency-javascript-startup-optimization/ https://web.dev/optimizing-content-efficiency-javascript-sta... the js size budget is about 800kB minified (1s to parse/compile). So if an app max out the budget, the framework part is considerably 17.05%. Not bad, but if the median of react app is around 300kB which means the framework part is 45.4%. This is bad!
- JodieBenitez 4y agoAs an outsider (I mainly develop backends), but occasionaly working on frontends, Svelte is the one I found easier to use, that is the most useful for me without having to learn too much above what I already know about html/js/css. I wish it had something like vuetify though.
- newbieuser 4y agoDoes anyone use svelte for large scale applications? I'm wondering what the advantage is over other libraries
- NetOpWibby 4y agoFor me, DX. I'm writing a dashboard UI for a project as well as the marketing site, both in SvelteKit. It's so easy to write semantic HTML and I'm not forced to see divs everywhere (this has apparently been fixed in React). The reactivity bits are great. It's also lightweight. I've already seen comments here basically saying, "Yeah cool, React is here to stay" and that's fine. Y'all use that. Svelte is easy to pick up and a joy to use.
- rawoke083600 4y agoSvelte, you can learn in an afternoon. Have migrated Angular 1.X and Angular 6.* to Svelte in the past.
- randomsearch 4y agoI would say you can equally learn the core of Vue and React in a day, so that you’re actually building your app before the day has finished.
- veidelis 4y agoQuirks.. I mean rules of hooks in one day? You're not being serious.
- reducesuffering 4y agoYou could easily read https://reactjs.org/docs/hooks-overview.html https://reactjs.org/docs/hooks-overview.html , https://reactjs.org/docs/hooks-reference.html#basic-hooks https://reactjs.org/docs/hooks-reference.html#basic-hooks , and make a quick React UI with Vite in half a day for a junior dev. You're not being serious.
- randomsearch 4y agoYou won't be an expert, but you can be productive.
- for1nner 4y agoThe very first paragraph leads me to believe this is just a rewrite into svelte for the sake of it - I get it, Svelte is the new hotness on the FE-js-block, but this entire post stinks of "someone on the dev team advocated and fluffed enough figures to convince us. So now we're going to tell you why it was the right choice!" I say all this pretty confidently as someone currently maintaining a massive legacy vue2 app which we are currently rewriting into... *checks notes* React. Because we thoroughly vetted and PoC'd how we'd do it in Svelte and in Vue 3. The former is utterly untenable for an actual product-serving business - it is a pre-release, actively-developing product. Vue 3 is great, I highly recommend reacty-folks or frontend devs try it. We wanted the larger ecosystem (and boo to us for not being brave enough to support the growing vuecosystem). The framework is so new, trying to justify your decision based on State of JS surveys over the last three years is asinine at best - svelte's own UI framework[1] is not even at 1.0 (has only recently been renamed to sveltekit). Furthermore, there's a literal migration guide[2] to bring your app from vue 2 to 3. It's not easy. It's not painless. But being on vue 2 is equally painful. I'm also not sure what documentation or development this person is referring to because "restricted global access" is just patently false for both vue 2 and 3 - I don't even know what to cite here because it boggles my mind so thoroughly that I can't even conceive where you would come up with that "fact." Is this someone who's never opened their root app file? The place where one can pipe anything from decorators (and yes, enums???) to entire packages globally? [1] https://kit.svelte.dev https://kit.svelte.dev [2] https://v3-migration.vuejs.org/ https://v3-migration.vuejs.org/
- kristiandupont 4y agoYeah, "We didn't consider React because it would have taken too much time to learn" doesn't sound very convincing to me.
- randomsearch 4y agoIn what way is being on Vue 2 painful? Using it in production, zero problems, everyone understands it, does everything we need. Plan to migrate to Vue 3 for the nice to haves and to keep up to date, but Vue 2 is not painful at all. Considered React but I think Vue will be more productive for the team as a whole in the long term. Vue is more intuitive, better designed, and structured. But totally understand React has a larger ecosystem - we’ll just be building more stuff in house so understanding our own code will be more important than having a larger choice of dependencies. Did take a look at Svelte, agree with you.
- deleted 4y ago[deleted]
- NotJayden 4y agoFYI for the first Svelte example, you put "town" instead of "lastName" for the prop.
- bjarneh 4y agoOnly single brackets are necessary in Svelte //Svelte {fullName} //Vue {{fullName}} hmm
- aleksandrm 4y agoI question this author and his reasoning. Extremely weak and uneducated reasons. Single brackets vs double brackets, really?
- nailer 4y agoIt’s odd, judging from a lot of the HN comments in the recent tailwind article, people find the lack of CSS inside react components (out of the box, I’m sure there’s ways of setting it up) enough of a hassle they want to style things in HTML - just to keep their styling in the same component. Something Vue and Svelte and others solve out of the box.
- didip 4y agoAs an infrastructure engineer who sometimes try to write good looking UI for internal dashboards, I don't see much difference between the two. So why not go with the largest community?
- timeon 4y agoMaybe they choose performance over community since Svelte does not use virtual DOM.
- tchvil 4y agoParticularly saddened they didn't chose web components. After 25+ years of HTML, JS, CSS, the switch to TS, WebComponent(lit) and Tailwind in Vite is like sci-fi for me. But let's discuss this again when escapy.js the library, that does not exist yet, will replace svelte in 5 years
- Abishek_Muthian 4y agoJavaScript framework fence sitters who are planning to use Svelte for a component in your SSR application please note that that their Web Components support is very buggy and Svelte team has no intention to fix it, Because(In their own words)[1] - "Nobody on the core maintainers team is particularly fond of Web Components" Yet,Their official doc includes support for Custom Elements; I found that svelte is not the right JS framework for building specific components in a SSR app while trying to use it for feature in my Go application[2]. [1] https://github.com/sveltejs/svelte/issues/6481 https://github.com/sveltejs/svelte/issues/6481 [2] https://abishekmuthian.com/javascript-framework-fence-sitter-tries-svelte/ https://abishekmuthian.com/javascript-framework-fence-sitter...
- dmitriid 4y ago> planning to use Svelte for a component in your SSR application please note that that their Web Components support No idea why you put SSR and web components in the same sentence, and in a way that presumes that web components are required for that, or at all. 1. web components are literally incompatible with SSR and all SSR solutions for them are ugly hacks. 2. It's not just personal "fondness" that prevents Svelte from doing more about web components. There are multiple documented downsides, including by Rich Harris, the author of Svelte 3. As long as you pretend you need web components for SSR, no framework will be right for you, including web components themselves. Meanwhile every single framework is several light years ahead of anything web-component-related for SSR. Especially Svelte whose authors and contributors have thought really hard about SSR.
- Abishek_Muthian 4y ago> Bo idea why you put SSR and web components in the same sentence A typical JS framework fence sitter would build SSR first applications and might likely think about using a light weight framework like Svelte for a client rendered 'feature (or) two' like I did. > There are multiple documented downsides, including by Rich Harris, the author of Svelte In link [2] of my parent comment I've mentioned those, I've no technical contention on his PoV but that 'Custom Element' feature is buggy, Is not made clear upfront and that there's no intention to fix it. > As long as you pretend you need web components for SSR, no framework will be right for you, including web components themselves. What about web components first framework like Lit[1]? I'm not stating it as a fact, But asking? [1] https://lit.dev/ https://lit.dev/
- easytiger 4y agoThere are few things to make you aware of both the bleak futility and brevity of existence as the endless churn of JavaScript Frameworks
- exclusiv 4y agoBut it keeps us all feeling alive!
- hknmtt 4y agoSince i first stumbled upon Quasar(built on vue 3) last year, i have never looked back. It is all that I ever wanted and could never find. And with pinia instead of vuex it's all even simpler. Vue isn't going anywhere and neither am i.
- hardwaresofton 4y agoSvelte & SvelteKit has been wonderfully productive for me. It's a bit insane that I have adopted it across so many projects of mine despite the fact it is pre 1.0 (well that has more to do with me I guess), but I am just faster with it. I have used a lot of frontend frameworks over the years, and before SvelteKit Vue & Nuxt were what I was warming up to. The article really focused on measurable things like type checking and surveys (not sure exactly how much that's relevant to a single team), but if I tried to quantify: - Svelte/Kit is conceptually small - Svelte/Kit's diversions from common practice are disruptive at first but quite productive if you really let them sink in (ex. path based naming, +page.svelte/+page.server.ts/+server.ts) - Svelte's ability to run in various different modes (SSR/node/vercel/etc) is awesome At this point Vue3 & Nuxt3, Remix, etc have caught up in many ways but I really really love using Svelte/SvelteKit. I recommend trying it at least once.
- zztop44 4y agoSame. I normally prefer boring old tech, but I’ve migrated all my projects over to Sveltekit. Yep, breaking changes are annoying but it’s worth it. It’s got the point where you’d need to pay me lot to work on a Vue or (especially) React project.
- hardwaresofton 4y agoYeah I look at it this way: - Angular introduces structure, people realize that Directives are awesome but dirty checking is bad. - React re-focused frontend on components (to be fair Backbone/Marionette and some MVVM stuff was going this way already but whatever), people realize they really mostly just want big hierarchies of components and to minimize everything else. The Flux data flow pattern is alluring too but kind of unnecessary. - Vue cloned react but improved on it by introducing the data object via automatic tracking and radically simpler APIs. I read up and was productive with Vue in like... 1 day of reading docs. - Svelte builds on all of that, moves more magic into the compiler and introduces weird syntax but thoroughly consistent ergonomics and lower complexity. - Everyone goes SSR For people who want jobs, React is still king and probably will be for a very very long time. But you can pry SvelteKit from my cold dead hands.
- chimen 4y agoThe sort of article that is "so I can have something to write related to my main product"
- nlnn 4y agoAs a primarily backend person, it's always interesting to read about this sort of thing as an outsider with little appreciation for the nuances/challenges people face using these frameworks. I keep hoping things will settle a bit more so that I can someday pick one to learn in depth without worrying about it being replaced by the next hotness. Am I right in thinking the state of major players is roughly: React - incumbent, slow, vast, but widely used Vue - main challenger to React, aimed to fix many issues, but 2->3 migration tricky Svelte - lighter compiled alternative for smaller projects, faster, but more niche Solid - even faster, more similar to React, but too new/small for bigger projects
- deleted 4y ago[deleted]
- mozey 4y agoAs a backend person that used to be a front end person, there has never been a better time for using VanillaJS (or TypeScript), HTML, and CSS? > someday pick one to learn in depth without worrying about it being replaced by the next hotness So maybe the trick is to not use a framework. Like, I don't need a "framework" for backend dev, just a toolbox of good libraries. The tooling around TypeScript is similar to a backend language like Go, a very different experience from writing JavaScript a decade ago
- mattmanser 4y agoThere's always one.
- KyeRussell 4y agoIf you’re working on a reasonably sized project “without a framework”, and haven’t effectively built your own, I’m very skeptical of the engineering practices at play.
- mozey 4y agoNot using a framework doesn't automatically imply everything is built from scratch. Maybe I prefer calling libraries, instead of plugging my code into a framework. I could also implement patterns using the batteries included features of the platform. For example Web Components on the frontend, or a REST API on the backend built using the standard Go "net/http" package
- pojzon 4y agoWhen is the olan to migrate from Svelte to something new that pops up next week planned? All jokes aside, its hilarious how fast frameworks become obsolete in JS.
- llanowarelves 4y agoThe churn back in the backbone.js/Ember/Knockout generation was much higher. Seems to have mostly stabilized on React, Angular, and Vue, all about 10+ years old now. Though major versions of these admittedly can add a lot of breakage. (Angular 1 to 2 was devastating for many people). Of the alternatives, Svelte may be the biggest, and is 6 years old. Web Components are also a decade old concept (implemented to some degree for several years).
- progx 4y agoWrote some tools in php + html + vanilla js, around 15 years ago, still in use, with ZERO work to maintain them. Wrote some tools in the last 4 years in the new fancy js ecosystem, and have to update them them permanently, migrate to new version, and and and. I am sure, i did something right in the past, but i don't now what ;-)
- tgv 4y agoI didn't see anything about type checking. We have a pretty sizeable Vue2 app written in TypeScript (well, mostly, because some devs...), and using Component/Prop/etc. decorators, it's very readable. The html template checker/compiler unfortunately doesn't see the data types, but apart from that, type checking is almost perfect within a component. That saves so much time. And it has optionally scoped styles too.
- szundi 4y agoStopped reading when having {} instead of {{}} became an advantage.
- SPBS 4y agoWhen will mithril.js get the hype it deserves, I'm a sucker for simple tiny libraries with no dependencies and no build steps that are mature as well (6 years). I guess it doesn't have a flashy community with talks and developer advocates :/. I feel the same about htmx, another simple tiny library with no deps and no build steps. Why don't people recognize the advantage in that.
- actualwitch 4y agoNeeding a separate build step is not the hindrance that you think it is. For most developers it's a "set up once and forget" thing, and there are many cases when you would need to transform code during build anyway.
- lanecwagner 4y agoI had to use mithril once and absolutely hated it. Writing my HTML as JavaScript objects? no thanks
- rk06 4y agoIt will not happen anytime soon or ever. The key to large community lies in ease of adoption, convenience and performance. Mithril's hyperscript like syntax hinders its adoption. And now, with newer tools like solid and svelte, the ship has sailed.
- Existenceblinks 4y agoBecause bell curve. Mediocre developers are the curve and they evaluate tech differently. When most developers evaluate tech based on engineering metrics alone, we would make progress a lot faster. (The business benefit automatically comes with the curve).
- graycrow 4y agoPeople jump back and forth between Vue and Svelte (or another JS framework of the year), while Aurelia quietly does its job without too much hype.
- reactor 4y agohttps://component-party.dev/ https://component-party.dev/ speak for itself.
- _s_a_m_ 4y agoAs always, I find these ranking-based justifications for decisions just plain stupid and childish. Also with Vue 3 you won't have any issue and it is already out for a while, so what have you been doing anyways?
- wokwokwok 4y agoCome on, what do you want? They’re literally going: - we picked svelte - we got these benefits from it I don’t agree with everything they’re wrote but it was interesting to see they’re happy with it. > All in all, the aforementioned benefits and gains make our developer experience much more enjoyable Good for them. Glad it worked out. I will not be doing the same. I do not presume my experience would be the same. > I find these ranking-based justifications for decisions just plain stupid and childish Is no one allowed to have an opinion if it doesn’t match up with yours? It’s just stupid to make a decision, do a thing, then blog about why you did it how it worked out for you? Pretty harsh.
- StefanWestfal 4y agoDid anyone use Svelte for data intensive apps i.e. Dashboards?
- tonyoconnell 4y agohttps://budibase.com/ https://budibase.com/
- tym0 4y agoI don't think Svelte came out in 2019, I have a first commit on a Svelte 2.0 app from July 2018.
- satvikpendem 4y agoAs someone who switched from Vue 2 to React around when hooks were introduced, can someone explain to me why they like non-React frameworks? Based on my experience, they all have some drawbacks: - Template languages instead of JS. If I want to perform some operation, I have to use their if and for constructs in their unique template language. In React I can just write JS. - Due to the above, TypeScript support is often lacking or outright poor. IDE support also usually is less than React. The maintainers of the IDE plug-ins simply don't have as much bandwidth as those of React, likely due to lack of man power. - Vue has a weird plugin architecture, I remember that I couldn't simply import a library as in regular JS or React, I had to register it as a plugin for some reason. Not sure if the situation changed since Vue 2. - Vue also has a weird way of writing out the code, it had to be done inside an object in the script part of the single file component. - Speaking of SFCs, cool concept but again depends on IDE support. I'd much rather have a folder for each component and colocate my CSS and JS files there as in React, or use a CSS in JS solution. - Signals and two way data binding are not as good as people think. When you have a big enough project, you'll understand, as changing one thing can change something else completely separately and debugging is like untangling spaghetti. I actually had to do this for a big Vue 2 project and it just put me off from the concept. There's a reason why React has explicit one way binding, even if it's more code to write and wire up. - Hooks are incredible. For people who don't get it, they should actually read this GitHub issue about adding something similar to Flutter, the author Remi Rousselet is a well known library author and shows the value of hooks in any declarative UI framework. He explains how, much as functions encapsulate state, hooks encapsulate life cycles, and how mixins fundamentally cannot work the same way in a class based architecture with component life cycle methods. https://github.com/flutter/flutter/issues/51752 https://github.com/flutter/flutter/issues/51752 - Even if everything all else was equal, everything above was fixed, the main difference for switching is that library support is vastly, vastly lacking for non React libraries. The community assumes React first over anything else, and the quality of React libraries vs non React ones are night and day. Take react-three-fiber or Framer Motion for example, no way there's something of that quality in non React ecosystems - I even got annoyed by the lack of library support and being treated like a second class user and switched to React. The network effect is real.
- richeyryan 4y ago
- theN00t 4y agoAs someone who has helped a few companies change frameworks I can say with confidence that it all boils down to developer adhesion within the product teams more than anything the frameworks have to offer. If a few people don't get over their own personal biases they are likely to drag development time down even unintentionally, and the performance of the application will suffer from more shortcuts being made. A well written Vue2 app can be much more performant than a poorly written Svelte app. That said, here are a few observations I have made. Vue2/3/Svelte is the easier frameworks for the widest range of developers to use and maintain apps for. This is because of their approach to templating VS that of React for instance, not to mention how they handle styling though Vue2/3 is even a rung above that of Svelte when it comes to CSS. React is great if you want to convince the money people because they are more likely to have heard about it and how everyone is using it. Svelte has a lot of odd bugs and associated hacks you have to figure out, such as looping over a list may sometimes not work at all and you need to place it within {# key} hack, this re-renders everything within the block though so it kills performance. SvelteKit is unusable at this point, the routing system has undergone several major changes for example but there are constantly several breaking changes, DO NOT USE. Vue3 typescript support is near perfect, I have had more problems getting full typescript support in Svelte and React.
- jmull 4y ago> SvelteKit is unusable at this point, the routing system has undergone several major changes for example but there are constantly several breaking changes, DO NOT USE. They state sveltekit is feature complete and there are no more planned breaking changes before 1.0. I think you can use it now, with relatively low risk.
- rep_movsd 4y agoI question the project heads for deciding to migrate rather than build a new product UI side by side with the existing from scratch. Since 2014, we have done this several times UI+backend went from [Cruddy coffeescript + Node.js] to [Jquery + django] to [React 15 + django] to [React 17 + django] and after we were acquired [AngularJS + django] is ongoing. Backend has been python since the beggining. Public API server went from python to golang. Compute and Infra went from private baremetal to k8s. At no point was there ever any already running code being refactored or framework updated. We build an improved clone of what exists and plug it in after its been used by enough people in beta. We dont throw the old stuff away until new deployments are working on client premises under high loads and extreme usage. We dont force clients to upgrade unless serious bug fixes exist. We never change UI in a way that older customers have to do anything different - unless its a major feature upgrade.
- gkkirilov 4y agoBS article
- Rezwoodly 4y agoYeah it really is, also its not a migration its a rewrite. This is just hot trash.
- StreamBright 4y agoWe just did the reverse migration from Svelte to Vue 3.
- todotask 4y agoHow did it goes and the experience?
- StreamBright 4y agoIt was kind of smooth. The biggest problem with Svelte was the lack of libraries and semi broken tooling. I am still not sold on this heavy JS/SPA approach (I am a mostly backend dev) and really hoping that HTMX or similar project takes off.
- sheerun 4y agoCommunity and available packages should be most important factor, not after-thought
- lloydatkinson 4y agoI recently migrated from Vue to React
- _the_inflator 4y ago> frameworks' retention ratios (would use again / (would use again) This "metric" and the results leading towards are so misleading. What is their setting? Their context? > The number of developers: Two front-end developers worked full-time for two weeks alongside another developer who worked full-time for one week, so that's three developers involved Ok, a fairly small team with a small app. It is ok for me, if business allows for this migration. Small team, needs fun. The write-up is ok. However, as a general reminder: take context into account. These comparisons never include teams size. React is dominated by 1 person projects, if you follow the tutorials. I work in enterprise context, where I am leading 100+ devs and would always, always opt for Angular, since it is opinionated.
- skeeter2020 4y agoReact may be "dominated by 1 person projects" but that's very misleading towards the number of big React projects; those dwarf the volume in other frameworks as well. All you're really saying is there are no 1 person Angular projects.
- DrScientist 4y agoReading this thread I'm struck by how it's all about moving from this to that, or I use this framework because of these great components only available in X. Isn't the problem that most of these frameworks or components result in an either/or choice and fragmentation?
- igtztorrero 4y agoI never like Vue2 extra verbose code, when I meet Svelte, I think: "This is it, just want I need" then realized Vue3 is an intended effort of Evan You (creator of Vue) to look like Svelte, I start to use Vue3 because all frameworks and libraries that exists in Vue, actually using Quasar ( excellent and full framework to use Vue2 and Vue3 ) I don't know if Svelte will ever get the same punch of Vue Libraries and frameworks that exists now. Let see what happens. Meanwhile I stayed with Vue3 Cheers!!!
- schnulller 4y agoLol he's moving from the last hot thing to the current hot thing.
- EugeneOZ 4y agoIt's ridiculous to me to read that for some people it is desired to have CSS, JS, and HTML in the same file. I would never consider it an improvement.
- rk06 4y agoThat’s an interesting opinion as react, Vue, svelte are all in favour of having css and templates together with js. What do you prefer? IIRC, Vue allows you to move link to a separate html,css and js file from vue sfc file should you want it
- EugeneOZ 4y agoYou are right, I prefer exactly this - to separate CSS, HTML, and JS/TS. I know that “smaller components are better”, I agree with this rule, but I prefer to draw the boundaries myself, not forced by the capabilities of my code editor.
- dbrueck 4y agoIt's one of the things I love about svelte. Obviously global styles live in a separate place, but having scoped JS/CSS alongside the HTML its related to is a godsend, especially as a project grows.
- canyonero 4y ago> After using Vue 2 as our front-end framework for almost two years So a rewrite in less than two years? And Vue 3 was announced over two years ago: https://blog.vuejs.org/posts/vue-3-one-piece.html https://blog.vuejs.org/posts/vue-3-one-piece.html The original decision, to me, feels like the wrong one and with no long-term thinking considered. They are now making another poor choice based on framework-hype.
- LAC-Tech 4y agoIn most react codebases I've used, there's zero separation between business logic and code that touches react or redux. Meaning if you wanted to migrate, 95% of files would have to be re-written. Do Vue codebases in the wild tend to be different? Or would this have been a massive undertaking as well?
- solardev 4y agoThis is a great question.
- EMM_386 4y ago> Besides, the latters share the same concepts of single file components: logic (JavaScript), structure (HTML), and style (CSS) in the same file. Personally, I hate this. I currently work on a large Angular 14 (now 15) application that separates the view (HTML) from the logic (TS) and the styling (CSS). So you have essentially 3 files for a component. I don't understand why some developers love cramming this stuff into the same file. Angular's default style encapsulation prevents component styles from affecting other components. To each their own, I guess.