by nickdandakis · 7y ago · 0 comments
- Vue has a set of core libraries (Vuex, vue-router, etc) maintained by the same org.
- Single file components with scoped styling out of the box.
- Vue integration as a standalone runtime is a little easier than React (unsure about this one).
You can read more about the differences here:
https://vuejs.org/v2/guide/comparison.html#React
I couldn't find any official comparison documentation from the React docs, though.
My and many others dev environments lean heavily on Vetur and it.. Is plagued with various issues in various releases. JSX/TSX JustWork™ while SPCs are okay sometimes but other times are found wanting..
Honestly I think this is a step backwards. How many components my "component" is built out of should be an implementation detail.
<template>
<!-- A mustache-like template -->
</template>
<script>
// JS, TS, or whatever
</script>
<style scoped>
/* CSS, LESS, SCSS or whatever */
</style>
That components may use other components itself, no part of SFCs disallow that.I've never remotely wanted anything similar to this in Vue, but I have seen what you're talking about used in React, mostly for component wrappers to encapsulate logic. It's not something I like using or seeing but that could easily be swayed by my preference for Vue.
See how it's done in the guide. It wouldn't be as natural as react allows but should suffice for tiny, contained sub components.
https://vuejs.org/v2/guide/index.html#Composing-with-Compone...
The only thing that SFCs do is create a render function for you (as well as some CSS scoping magic). You can do that all yourself and that is all documented and supported behavior.
You have completely the wrong idea here and, honestly, this is all in the documentation.
> React makes no judgements here
Vue typically has fewer opinions than React (and FAR less than Angular) in my experience.
I prefer having the template, styles, and code together, but it isn't required.
In fact that's what I've encountered in most companies, and what I usually do for my side projects. Basically you output a <app>.js and <app>.css and integrate those in your app layouts / templates.
That's a problem with all these CLI and all those tutorial targeting SPA with a node backend. But IIRC vue-cli as options to help you achieve that, but the docs are not always the clearest for this.