5 ms·
The perceived upfront cost is lower with Vue. You can just put it on the page and voila, you have observables, computed properties, templates, everything. No we
by spion 10y ago
The perceived upfront cost is lower with Vue. You can just put it on the page and voila, you have observables, computed properties, templates, everything. No webpack, no transpiling, no modules, no npm.
This is also how angular got popular. The tutorial said: Just add this one JS to the page and start making SPAs! Here is a 10 line example with everything in it explained, and it works!
Same with mongodb - their 10 step interactive tutorial website was extremely convincing
Not many people know you can get started the same with react by putting react, mobx and mobx-react on the page https://jsfiddle.net/ugh2xhfg/ https://jsfiddle.net/ugh2xhfg/. Thats because its not advertised. You will still need babel / compilation though. JSX is still a major barrier to entry.
There is no easier way to make a project become popular than to offer an unrealistic-for-production getting started page that will get you rolling by doing almost nothing!
- sandGorgon 10y agothat jsfiddle comment was awesome! I never even found that when i was looking for mobx examples!
- ng12 10y ago> You can just put it on the page and voila, you have observables, computed properties, templates, everything. No webpack, no transpiling, no modules, no npm. This is a false dichotomy. React is a fully-featured, standalone library and functionally equivalent to Vue if all you include is react.min.js. You don't need webpack or npm, you don't need Redux or MobX. This attitude stems from people learning React from create-react-app (which is geared towards a fully-featured, multi-developer, production-ready application) without doing FB's TodoMVC or even reading the React docs.
- throwaw199ay 10y ago> This is a false dichotomy. No, React beginner tutorial implies learning JSX , then you need to compile JSX into JS. Vue.js does none of that. You just write Javascript and HTML. And yes, Vue.js also supports server-side rendering.
- ng12 10y agoThe argument is passing your source code through a REPL makes it significantly more difficult to learn? Learning JSX isn't any more difficult than learning Vue's template binding syntax.
- BinaryIdiot 10y agoYou're completely ignoring the argument. React doesn't really tell you that you can just grab that file but even so you still need to get JSX processed. It's all about the friction. Vue currently offers significantly less friction to jump into than React.
- nailer 10y agoJS -> JSX is transpilation, not a REPL.
- woogley 10y ago> React is ... functionally equivalent to Vue if all you include is react.min.js Not really, you also need react-dom.min.js ;) But even then, Vue is sporting automatic reactive dependencies, computed properties, watchers, conditional class names, and other things without requiring a trip to some random NPM package. And it's still a smaller payload than react/react-dom
- spion 10y agoRight. You need inferno-compat as a drop-in replacement for react, as well as mobx for all the other vue features. The payload for that would be similar to vue: 15KB min+gzip for mobx + 7kB for inferno-compat + 4kb for mobx-react = 26KB min+gzip. Latest vue is also 26KB min+gzip
- brilliantcode 10y agoI don't think you can ignore the relative less amount of pain associated with Vue.js over React.js. It's just easier to get started with Vue.js and I'm just tired of the constant marketing campaign from Facebook...guess what 99.9% of companies out there aren't facebook or google. The relative ease to get into Vue.js and it's fast growing popularity are signs that it's hitting the right pain points with developers who don't work at Facebook.
- spion 10y agoThe thing is, in any real project where you need a front-end framework, you will need modules very soon. And once you need modules, you need a bundler, which means you need a build process. While you are building, you might as well take advantage of neat ES.next / TypeScript features such as decorators, as well as maybe type-checking for JSX templates, and so on. This is the reason why I always choose React. (Well, that, and the huge existing ecosystem, and fact that components are first class in the template language e.g. you can pass a component as a parameter to a template and you can bring components into scope by importing them. But those are fairly advanced features)
- victormustar 10y agoAnd you have everyone of those with Vue too btw
- spion 10y agoNot really. You don't have typescript's typechecking for templates. You don't have higher-order components or first class components. Scoped slots are almost there, but not quite. Also, "scoped slots" show that vue's simplicity is a bit of an illusion. There is a lot of reinventing the wheel happening underneath to get templates to the basic level of modularity / encapsulation / features of plain old JS. It was similar with Angular. "Look how simple it is!" - yeah, until you actually need to build something serious with it... then you need to learn 3 times as much as React and all its tooling. Here is an exercise: Write a spinner component in vue that renders either a spinner, an error message, or any other component (must be passed to the spinner component as a parameter) to which you can pass the data of the fulfilled promise. Here is a react implementation: https://jsfiddle.net/mm145xkj/ https://jsfiddle.net/mm145xkj/ You just write a component where you pass two props: a promise to monitor, and a function that will take the data of the fulfulled promise and use it to render anything. How do you do that in Vue? Is it simpler than the React implementation?
- caseymarquis 10y agoI started using vue because of the webpack integration and the wonderful single file html/es6/css components. Maybe I'm in the minority? It takes a while (and some guessing) to get it all set up, but it's incredibly productive afterwards (vue-router is a must).
- flukus 10y agoAlso, you can add it to an existing project, no need for a rewrite of anything.