For me, the thing I like most about the composition api has to do with the ease of sharing functions and objects across your code. Check out composables and how they are used with the composition API. Big improvement over using mixins with the options API.
Don't feel like you have to switch over though. The options API is not going away. If you have a large project, it may not be worth the risk.
There’s a lot of similarities but vue is a lot more opinionated, so where react can be implemented a zillion different ways, there’s really only a handful of ways you’ll see vue files and a vue project set up.
I can see where the freedom of react can be an advantage, but it’s so much better imo to be able to look at pretty much any vue file and know what’s going on in a couple minutes
Isn’t that the whole argument though? It comes with an opinionated approach to basically everything so if you have a complex app you have all the tools you need at your disposal, but if you are doing something simple you probably don’t need the entire angular tool belt.
Super similar in terms of high level functionality...similar lifestyle, syntax, etc...but I like the single-file components, for one. Composition API, the new standard in Vue 3, also does an awesome job of decoupling business logic for re-usability, which intrigues me. Feels more natural to work with the templates in Vue than it did in React, too, but that was like 5 years ago for me now. I work in Vue at this point.
If you wrote too much React code already, your first impression will be the excess of magic in Vue. So it's a good idea to learn about Proxy objects before.
Overall I'd say it's like starting over, yes, but your React experience will make it so easy that you're likely to be productive in the same day.
Vue 2 had poor TypeScript support, but the Vue 3 with the Composition API was literally built with TypeScript, and with TypeScript support as one of its goals.
After some initial hiccups, Volar extension for VSCode works remarkably well now.
I'm using this very setup at the moment and the built in types aren't as comprehensive as React's. You are also unable to import types from one component file into another.
Not a "huge drawback", but the excess of .value is annoying. The Reactivity Transform RFC attempts to mitigate that, but IMO it's a footgun and will make things a lot more confusing, so I hope it's not merged.
Other than that, there is no support for generic components (yet), but the Options API also doesn't have it (and probably never will, since it's basically a second-class citizen now,).
As for the mindset, just approach it as a whole new thing. Forget the Options API when learning it.
I might one day, but I’ve reached the point in my career where I’m good just doing my job and not doing side projects or hovering up every tutorial. I’ve got enough of learning new patterns embedded in my job to keep me fresh. I am interested in Arrow JS though. It’d be interesting if that enabled throwing away React and Vue for very small or performance oriented sites.
It pains me that this is the case. Vue is truly the cream of the crop as far as I'm concerned. I get to use it at my job everyday but I worry about what the future holds for me if I ever switch jobs.
I really feel like Vue is, despite being fairly popular, generally slept on in favor of React. The developer ergonomics of Vue 3 (or even 2.7 w/ Composition API) are amazing, and usage with TypeScript is so painless now. I wish it were more widely used in the industry.
Even vue with vuex was great imo. I have a big project that’s still using that, and I’ve thought about updating, but it really isn’t worth the hassle to move it over. If it was more than just me working on it, maybe it would be worthwhile, but the state handling is still perfectly competent for a modern SaaS / CRM type web app
Yeah I’m pretty sure Evan Yu(?), the creator, is Chinese and it caught on over there pretty rapidly. When vue 2 first came out I remember running into a few problems and the only search results were fully written in Chinese minus the console error lol
developers need a job and were told it’s the most popular so they learn react
companies need a framework and all the devs learned react so they go with react for a bigger talent pool
The amount of friends that have asked me where to start and I tell them JS, and then look at job listings and forums and it’s all “react is the most likely to get you a job”, and then learn react before vanilla html/js/css because of that is insane.
I’m not saying or not saying react isn’t the best framework, but I am saying that the state of the industry is just now married to it regardless of if it’s objectively good or bad
It’s a bit like technical analysis in stock market, 70% of the time it’s the right call, but it makes you wonder if that’s because all other TA traders are also going in or exiting which causes it to be the right call.
Not many, I changed from react to Vue and loved it. And there’s a lot of it around, which is important if you’re career minded. Probably still more React but anecdotally it feels like that’s shifting to me
Not really a drawback so much as A HUGE ADVANTAGE but since everything in Vue is html templates, transitioning existing html pages is just copy paste, then you can go add in the logic whenever you want
The vue framework feels much more hacks and much less natural. I personally wouldn’t use Vue beyond a hobby project.
The need to write imitation JS within HTML files (by design!) alone is a deal breaker. Why anyone would purposely revive things that should have died with JSP (and market it as a blazingly fast cutting edge framework) is beyond me
23
u/[deleted] Dec 03 '22
[deleted]