Python 3 vibes. Terrible decision. Our team has decided after seeing this to use Vue 2.x until we can move away from Vue. Extremely disappointed. Simplicity was Vue’s bread and butter. Literally the only reason to use it over React. Now what’s the point? We get it, you’re a smart guy who likes FP, quit punishing the rest of us.
I'm not a fan of this RFC but how can you make such as drastic decision at such an early stage?
Vue RFC: Expose logic-related component options via function-based APIs instead
211–220 of 253 posts
Re: Vue RFC: Expose logic-related component options via function-based APIs instead
#212We also have our own Redux/Vuex-inspired uni-directional state management solution that uses immer under the hood.
The next step, largely motivated by the fact it's hard to find developers who want to work with older frameworks, is to convert the app into Vue from the inside-out using ng-vue as glue, and when all components are Vue, remove the outer angular shell.
So we have been tracking these proposals. The original class-based RFC looked perfect for us, since that was 95% matching how our current (class-based) components look like. Seeing it get abandoned was a cold shower, but okay, not the biggest problem. Our components are as dumb as possible anyway, and we have all business logic in services. It'll just be some additional manual text-wrangling work.
The new proposal looks okay. I guess, just as React hooks made classes unusable in React, they had to go from Vue as well (though honestly, I don't really see the fascination with hooks, but maybe that's because we don't do anything like the Hooks examples I've seen in our app). I do really like the idea of the reactivity system being completely separate from the rest of the framework.
I personally never liked the original JS-only API either, with the { props:, methods:, computed:, } etc. "separation" (commenters here call it "simple", but I think it's far from that), so in my Vue 2.x projects I used vue-class-component.
Overall, the motivations and reasoning in this RFC seem sound to me.
However, here I come to my three biggest problems I have with this API:
1) The fact that you have to return the render props from the setup() function. It's annoying repetition, and I foresee people forgetting to add a newly added prop here. It also makes the definition of the component feel procedural instead of declarative. You have to read/mentally run the setup function to know the shape of the component. Hopefully maybe you can notate the setup() function return type to match a TS interface without breaking editor support?
2) The fact that they couldn't come up with a better-looking way to declare a prop with a complex TS type other than `prop: (null as any) as PropType`. I guess I could make a noop generic helper function for this, though.
3) props are optional per default. I feel this is the completely wrong default for a TS project (mentioned as a consideration in the RFC though)
Re: Vue RFC: Expose logic-related component options via function-based APIs instead
#213Earlier quoted context omitted.
I feel like I'm shilling a bit for React over here, but they are nearing two years without major breaking changes, and has been the de facto framework to go to for quite a while now.
It seems inevitable that hooks will be the only API 3 years from now though, and its already the case that all the new literature and examples are only going to teach hooks. Vue might maintain compatibility just as long but they've totally hosed their messaging on this judging from all the comments in this thread.
But yeah, for now it appears they'll maintain compatibility well enough.
Re: Vue RFC: Expose logic-related component options via function-based APIs instead
#214Hopefully history will repeat itself and some clever dev will fork Vue 2.0 and create a new framework which has all the good parts of Vue 2 and nothing from this react inspired Vue 3 and all would be good again (just like Evan did when Angular went rogue)
Re: Vue RFC: Expose logic-related component options via function-based APIs instead
#215Not a Vue programmer, but looking at the code, why is the example code using {{ count }} instead of standard JS interpolation like ${count}, and using an App.template block instead of just returning the template with the count and other params. E.g. why not just make it plain JS, and minimize framework surface? I could rewrite that example removing almost all of the "Vueisms", and it wouldn't be a single line longer.
Re: Vue RFC: Expose logic-related component options via function-based APIs instead
#216Earlier quoted context omitted.
I'm aware of that - hence the form of my previous comment. "This time it's different" though. The difference being: this here is radically less complex and unlikely to become much more. All this complexity in frameworks was always added in a vicious cycle, namely: 1. Developer looks at a component - they see complexity. 2. They don't know how much of it is due to the business logic being complex and how much is intro…
Are there any svelte tutorials/examples that specifically target vuejs users?
Anyway Rich Harris' presentation is a good starting point:
Re: Vue RFC: Expose logic-related component options via function-based APIs instead
#217Vue team lead here. There is a lot of FUD in this thread so we need to clarify a bit: - This API is purely additive to 2.x and doesn't break anything. - 3.0 will have a standard build which adds this API on top of 2.x API, and an opt-in "lean build" which drops a number of 2.x APIs for a smaller and faster runtime. - This is an open RFC, which means it's not set in stone. The whole point of having an RFC is so that u…
Re: Vue RFC: Expose logic-related component options via function-based APIs instead
#218Well that's enough to reinforce my switch to https://svelte.dev I want a JS framework simple enough that even hobbyist devs can understand in an afternoon. React syntax is an overly complicated mess; like reactivity forcing itself onto HTML. Current Vue syntax is neat, simple and clear; like HTML with added reactivity.
A JS framework that a hobbyist can understand in an afternoon is frequently, but not always, not a framework that works at cloud scale. I support all the choices you make, but there are those of us who have good reason to value useful complexity. <3
Re: Vue RFC: Expose logic-related component options via function-based APIs instead
#219Earlier quoted context omitted.
It's not a new feature it's a complete new methodology.
That's quite hyperbolic. Functional components have existed in React for a long time, hooks are just adding existing concepts (state and lifecycle operations) to them.
Re: Vue RFC: Expose logic-related component options via function-based APIs instead
#220Earlier quoted context omitted.
Hopefully they recognise their niche and stick to it. I'm particularly interested in Svelte for compiling down to vanilla WebComponents to be used in P2P apps (eg Holochain) where you want the end users to be able to modify components themselves.
Svelte has supported compiling to custom elements for over a year.