by alipang · 7y ago · 0 comments
The Vue implementation seems to ultimately lack this core understanding, and comes off almost a bit cargo-cultish in comparison. React has hooks, so we must have something similar.
I don't mean this as singularly bad, I'm certain Vue can be productive and that this can be a productive feature for Vue devs - but when will we as an industry manage to evaluate software by semantics rather than the syntax we prefer? Does Vue truly offer anything over React that's not in the realm of preferred syntax?
Yes, there's some obvious copying going on here, but this is not a bad thing! There's been a lot of cross-pollination and inspiration between the major frameworks and ecosystems.
While I haven't deeply inspected the exact details of the new Vue APIs, my understanding based on discussions is that the Vue team has heavily adapted the hooks APIs for a more Vue-idiomatic approach. This includes things like removing the need for the call order limitation, only calling them once on setup, making use of Vue's reactivity, and so on.
Those changes fit well into Vue's stated focus on ease of use and handling a lot of behavior automatically.
This gives the Vue community a chance to benefit from some of the same concepts and improvements that the React team has described for hooks, while staying with their same toolset.
I'm entirely happy with React and have no plans to switch, but there's plenty of reasons for folks to choose Vue (and similarly, each of the other frameworks). I gave a list of some reasons why you might pick each of them a while back on Reddit [0].
[0] https://www.reddit.com/r/javascript/comments/avsuei/react_vs...
[0] - https://vuex.vuejs.org/
What does "actual CS concepts" event mean? This is the first time in my life that I've heard about algebraic effects.
If I am understanding your comments, the implication seems to be react is implementing concepts that elevate the tool while vue goes around in circles to make an alternative syntax.
I don't even agree that the react team has done a good job with implementing a clear concept for their framework. Things like Elm have done a much better job of that. Granted that's a lot easier to do when they don't have to force themselves to deal with js directly.
But even then, why is react implementing hooks not bad, but vue implementing them is? There's a reason why react made the switch, and some of those advantages also apply in vue. These changes aren't just made to follow trends.
When I say "actual CS concepts" I mean things that have been broken down into it's core using a suitable mathematical model. This is ultimately a much more suitable way bo build tools used by engineers.
My personal concerns is that Vue to me is mostly just a reskin with new syntax on things that are already in React. Hooks become the "composition api". Redux becomes VueX. Is this necessary?
Could VueX just have been an alternative to Redux, like MobX is?
Could we just have implemented a Webpack-loader to put styles and react components together?
Some people don't like that React uses `className` instead of class. Is `v-bind:class` and various `@` notations really so much better we can justify a whole new ecosystem?
So roughly - Vue provides fragmentation in the frontend ecosystem. I like competition - but what does it really offer that justifies it? I don't get it, and now what they have been working on is just catching up to React.
But I found JSX hard to read and there was no consensus on how to write CSS and some people were saying that it was ok to use inline styling. WTF? The web design community have been telling me the opposite for years!
Then I started working with Vue and everything fallen in place: no deprecated lifecycles, CSS into style tag and easy to read markup with no Array.map() returning HTML tags.
Fragmentation is bad, but is nice to have a balanced option between extremes.
- 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 prefer having the template, styles, and code together, but it isn't required.
Let me give you some background about myself - I'm a full time consultant, I write both frontend and backend code for a living. I have worked for almost 27 companies in the last 2 years as a consultant. I have used both.
Vue may copy react, but their implementation and opinionated code structure (Eg. Single file components, Vue-Router, Vuex, etc.) is so much better than the complete freedom that React gives you. Almost all of them who used React had terrible code quality and really bad code organization. In contrast, the Vue code base I've worked with all had some level of uniformity enough for an external consultant to come in and understand what was going in. The worst code I've ever seen till date was on React from an analytics firm. I lasted 15 seconds after which I closed the tab and re-negotiated the contract to do only backend for that firm.
I'm not saying React is bad, end of the day, they're all just tools, but a vanilla TODO Vue application with its syntax is much much better to work with a vanilla TODO react app. Especially for large codebases, this is so true when you work with stuff to manage state like Flux/Vuex.
I also observed that companies using React usually also tend to do more re-writes of their codebases as it becomes unmaintainable over time without an opinionated way to do things like with Vue. Companies with Vue also seem to be more profitable and less reliant on VC money. You can feel free to verify these stats by heading over to LinkedIn/Angel.co and checkout the companies who hire for Vue/React.
So, to answer your question - Does Vue truly offer anything over React that's not in the realm of preferred syntax?
Definitely (as I explained above). I personally would never touch React for a prototype or a project that needs to go to market with less bugs.
These would be almost identical in structure and design. You're drastically overstating the difference between React and Vue.
I do agree that Vue seems to be reactive in its choice of features, in the sense that it tries to be everything to everyone.
The underlying problem IMHO is that these frameworks are unwilling to create major breaking changes (since that would hamper marketability) so it's easier to just shove things into the unused edges of the semantics space until they becomes a hodge podge of a million ways of doing the same thing.
I feel like Angular is the one framework that sorta "gets it" now. It went all the way to CS lala-land w/ 1.x and rewrote from the ground up for v2 taking several lessons from its v1 and from elsewhere.
Sounds like you want Mithril, but keep in mind that backward compatibility and marketability are, in fact, useful features.
They are (and FWIW, the Stroustrup quote[1] is quite applicable here). I'm merely pointing out that feature creep leads to bloat/complexity which lead to people to complain, and that feature creep also leads to marketability (which is a reason why mainstream language spec documents typically have hundreds of pages). Personally I think this pattern is a problem, but I don't know if anyone has managed to figure out a solution.
[1] https://www.goodreads.com/quotes/226225-there-are-only-two-k...
If "long copy sells" is the reason why feature creep leads to marketability, then maybe an abundance of examples would help.
JS Framework, CSS methodology(UI framework?), etc... or any other perspective you want to share.
Is that a good thing?
Arguing that we should pick tools based on semantics without considering syntax is like arguing people should pick spouses based on genetics and not personality.
Presentation is only a small portion of an application. A view rendering engine is required to do a couple of things, accept and render data.
The semantics of how it accepts data enables good software engineering practices like dependency injection and dependency inversion.
The semantics of how it renders data enable ergonomic usage of the renderer (templating, JSX).
Modern web developers tend to write "React" or "Vue" applications - not "Type/JavaScript applications that render with React"
Global objects, singletons fetched from module-powered service locators, unlimited power global stores and enough boilerplate to make the most hardened Java developer confess their sins to Oracle.
Looks like Vue 3 is fine but continues the trend of doing it all.
Aren't hooks only needed because React and Vue still use a virtual DOM?