Sacrificing Simplicity #378
Replies: 3 comments 13 replies
-
How did you get to that conclusion? Vue hasn't sacrificed its API
What examples are you talking about? |
Beta Was this translation helpful? Give feedback.
-
The keyword is "you are able to", but also you don't have to.
The Angular/Lit resemblance are never on the default path - they cover edge cases for users with strong opinions, but they don't affect typical users. When it comes to the co-existence of Options API vs. Composition API - in a way, that's an inevitable cost when we try to introduce fundamental new ideas into the framework without breaking existing APIs. Consider the other options:
I don't think either of the above would be better than the current state. The good news is that the API and DX around Composition API has stabilized, so the main focus now is to overhaul the documentation to provide a clear recommended path using the new APIs. This is exactly what we are working on at the moment.
Yes, the docs are a bit outdated in this regard. The current recommended approach is:
|
Beta Was this translation helpful? Give feedback.
-
I want to be super mindful about the awesome work that has been put into Vue 3 when I write this. I do think that there are some more points that can be discussed here, and I just want to share my experience as a Vue user in hope that they can help when thinking about those new docs! The coexistence of Options API and Composition API is deeper than backwards compatibility or trying to introduce new ideas without breaking old ones. It isn't similar to React Hooks vs React class components, for example: you can use the Composition API in the same component as the Options API. If the recommended way forward was to go all-in Composition API, it hasn't been clear up to this point, and even with the release of <script setup> there's a lot of ambiguity and surface API complexity that come up when adopting use of Vue 3.
Or I could use the setup hook and basically replace the options API entirely, and stick everything in there. But why should I do that? What are the tradeoffs here, and what is Vue's position on its own Options API? So far, everything has been up to me to figure out. Should I figure this out on a component-by-component basis or on a project-by-project basis? Yes, it can be great that I "am able to but don't have to", but it provides additional overhead and complexity - if the community can do anything here, a Vue developer should better learn everything. The new <script setup> hook does seem to commit to a way of using the composition API - replace everything with it - but that isn't how the project has presented it. In the blog post it's described as "a compile-time syntactic sugar that greatly improves the ergonomics when using Composition API inside SFCs" but we still lack clarity on when we should use Composition API inside SFCs. I certainty lack clarity on the place of the Options API in Vue's philosophy in 2021. Is it indeed just a way to support the old way of doing things, but the Vue team has devised a better way? So far, it's hard to tell from the docs that Vue believes the Composition API - let alone the <script setup> - is any better than the Options API. |
Beta Was this translation helpful? Give feedback.
-
At this point, Vue will pretty much let you use any pattern from any framework you want. If you want Vue to look and feel like React, you can make it look and feel like React. If you want it to look and feel like Angular, you can make it look and feel like Angular. And with the new component definition API, you'll be able to make it look and feel like Lit. While this flexibility is attractive, I worry that Vue is sacrificing the simplicity that made it so attractive in the first place.
There is no clear or documented approach on the best way to use typescript, which leads to a lot of confusion as examples online are either simple and straightforward or quite over-engineered.
Beta Was this translation helpful? Give feedback.
All reactions