4 ms·
I'm not the author, but that quote lines up almost exactly with our experience. First, Vue shares most of the things that actually make React exciting. Compone
by vec 9y ago
I'm not the author, but that quote lines up almost exactly with our experience.
First, Vue shares most of the things that actually make React exciting. Component oriented, one-way databinding, virtual DOM, a first party Flux-inspired state management plugin. We didn't feel that we lost anything moving from React to Vue, and most of our existing components were trivial to port.
What we gained, on the other hand, is a whole lot of developer comfort. Vue's template syntax can be read and manipulated by people who aren't primarily Javascript developers. Directives and filters eliminate quite a bit of boilerplate. Opt-in two way binding eliminates noisy setter functions without any loss of clarity. Getters enable the use of computed values as though they were raw data. There's no single killer feature, but taken together Vue just feels much more pleasant to use than React.
React has the correct fundamental abstraction, but the actual API mistakes "small" for "simple". JSX, in particular, is trivial to explain and understand in theory, but in practice is often quite verbose and complex to use, as everyone who has asked themselves "how do I actually write an if/else block" has discovered to their dismay. Vue plux Vuex keeps the same conceptual simplicity and cleanliness as React, but it pairs it with a much larger, much more opinionated API that doesn't force us to reinvent every wheel we need.
- hashkb 9y agoYou don't mention mobx. If you haven't used it, you ought want to give it a look and reconsider your opinion
- rpeden 9y agoI enjoy mobx a lot, but I don't think it really address most of the points vec raised. The way I look at it, it's not a contest. If Vue is better for some developers and some teams than React, that's great! It's nice to have multiple good tools to choose from.
- nlperguiy 9y agoAccording to https://vuejs.org/v2/guide/comparison.html https://vuejs.org/v2/guide/comparison.html , vuejs is less verbose React + Mobx.
- ianstormtaylor 9y ago(Not familiar with Vue.) When you talk about "template syntax" and "directives and filters" are those a non-full-JS-style of templates? As in can you execute arbitrary JS like you can with JSX? Just curious. For me JSX is one of the biggest reasons that React is much, much better than Angular. I've found that once you get into re-implementing for loops, if statements, fallback defaults, etc., etc., for the sake of templating in an entirely new DSL, it becomes super complex and hard to learn/remember.
- corford 9y agoVue lets you go the Angular route with templates or the React route (it supports JSX out of the box).
- ianstormtaylor 9y agoWhich way are 90% of the Vue components, applications and examples written with?
- corford 9y agoI think both ways are simple enough to grok it doesn't really matter and just comes down to personal/team preference (personally, I prefer JSX). The nice thing is Vue allows you a choice rather than making it dogma. As another commenter said, this can come in handy in certain situations (e.g. dealing with forms).
- vec 9y agoNo, Vue's templates do not allow arbitrary JS. The syntax is very Angular-like, in the sense that everything is pseudo-html using custom tags and attributes. But the builtins are extremely well thought out and in practice I rarely find myself having to re-implement much of anything that's not application specific, and most of those things I'm grateful to implement once and be done with it instead of having to reimplement in JS for every component that needs it. There is more of a learning curve, in the sense that it only took me 1-2 hours to feel like I fully understood JSX and maybe a day and a half to feel like I fully understood Vue templates. I, personally, don't find that argument very compelling. ~10 dev hours is a rounding error over the lifetime of a project, and anyway I spent at least that much time researching and/or reinventing JSX conventions and idioms that are obvious or trivial in any real templating DSL. I only had to climb the conceptual hill once for each framework, and the view from the top is much nicer in Vue. As an aside, Vue actually supports JSX out of the box. Any component can optionally include a `render` function that's almost exactly like React's `render`, and it falls back to using Vue templates only if no `render` is specified. Anecdotally, though, there is only a single component in our entire application where the team decided it was cleaner in JSX than with a template.
- nightski 9y agoThe funny thing is Vue templates just compile down to something similar to JSX. It's just object construction. Just how Vue has JSX support I'm sure react could add template support. I personally wouldn't want anything to do with it as I find JSX a lot easier to work with but it wouldn't be that hard to do.