9 ms·
Not a flamewar, starting a new project, VUE or React?
by _Codemonkeyism 9y ago
Not a flamewar, starting a new project, VUE or React?
- beckler 9y agoThey're both pretty similar. I would say try working with both on something really small and see which one you like better.
- tomelders 9y agoVue.js is more of a DSL. React is just Javascript. I'd say they're two very different approaches. I'd recommend react over Vue any day of the week, to answer ops question. Vue.js is everything I hated about Angular. String based dependency injection, bizzare attibute syntax, highly opinionated. React is everything I love about javascript. Functional, fast, and with an easy to reason about API.
- wolco 9y agoIt's not as opinioned as you think. All of the reasons you listed for disliking are just one way of writing it in vue. If you love jsx and pure javascript you can use them as well. I learned react before vue and found it great compared to angular but lately I've been using vue. It is quickier and neater with the bizzare syntax and lighter overall. With the latest release I have the urge to go back.
- mediumdeviation 9y agoCounterpoint: React is no less opinionated, fast, or has less of a DSL than Vue. Opinionated: React is a library written for a language that is not JavaScript (the first prototype was written in OCaml). It demands immutability, which JS has no native support for. it wants you to use FP, but JS natively has little support for FP both in its standard library and syntax. FP only looks good in JS if you've never used a real FP language. DSL: JSX is a DSL - I can't remember the last time I've seen someone use && as a poor man's if statement, or ternary statements dozens of lines long until I started writing JSX. JSX is neither idiomatic JavaScript nor HTML. Fast: Performance benchmarks (which admitted are flawed as they can't capture real-world usage) show that React and Vue have similar rendering speeds. Vue's computed property dependency tracing means that a lot of the performance optimizations which require manual work to enable in React (manually memoize expensive computation, shouldComponentUpdate, PureComponent etc.) are handled automatically by the framework.
- root_axis 9y ago> it demands immutability, which JS has no native support for. You don't need native support, just don't mutate state when calling setState, which is a pretty simple rule to follow. > it wants you to use FP, This isn't really true. React components are often written as ES6 classes and stateless functional components are only functional insomuch as they are literally just a function. I can't think of any advanced FP concepts that are necessary for idiomatic React. > JSX is a DSL Technically true, but in practice it is just ES6 and the HTML side of JSX so closely resembles actual HTML that the DSL criticism loses most of its meaning. > I've seen someone use && as a poor man's if statement It may be a code smell, but it's certainly valid JavaScript and not a technique that could be correctly described as contributing to the idea that JSX is a "DSL". Also, you don't have to do that, just use an if statement or a ternary operation to compute your result outside of the JSX block and reference the resulting variable in the template part of the render function.
- shaneos 9y ago> React is a library written for a language that is not JavaScript (the first prototype was written in OCaml) This is incorrect. React was written first in JavaScript in the Facebook Ads org, to be used in the Ads Create Flow application. Jordan's dive into OCaml came later, which is why we now have Reason many years later.
- tomelders 9y agoOn JSX... ok, that's not Javascript. Nor is it HTML. But it absolutely the right tool for the job, if that job is creating component based web applications. JSX is such a perfect fit that I take umbrage with people who sneer at it. What better way is there to bridge the gap between the DOM and Javascript? And JSX isn't exclusive to React anymore. That's testament to how useful and practical JSX is. I can see JSX becoming bona fide standard like HTML.
- mlsarecmg 9y ago> DSL: JSX is a DSL - I can't remember the last time I've seen someone use && as a poor man's if statement, or ternary statements dozens of lines long until I started writing JSX. JSX is neither idiomatic JavaScript nor HTML. Nothing in React forces you in any way to use ternaries. You can do all your pre-calculation in the render method, and if that's your style you would most certainly do that. const Say = ({ reverse, text }) => { if (reverse) text = text.split('').reverse().join('') return <div>{text}</div> } <Say reverse text="hello" /> Btw, Vue isn't any different here, you use ternaries there as well, only that it's severely limited as you couldn't refer to other components, the template is a dead string after all: template: ` <li v-for="(item, index) in items"> {{ index > 2 ? item : item.split('').reverse().join('') }} </li>` > It demands immutability, which JS has no native support for. It doesn't do that at all. Even redux uses plain shallow copies. Vue on the other hand does exactly that, it uses observables which aren't supported in most browsers. Reason why as of version 3 you will maintain two codebases (one for IE11 and prior, one for evergreen) since Proxies aren't back-compatible. > it wants you to use FP Not at all. It is unopinionated.
- kevin_thibedeau 9y ago> Vue.js is more of a DSL. You can use Vue as plain JS. You don't lose much by abandoning the single file components. > React is just Javascript. Except the entire ecosystem is designed to steer you toward JSX which is not "just Javascript".
- mlsarecmg 9y agoJSX is just JavaScript. const A = () => <div>hello</div> Is the same as const A = () => h(“div“, null, “hello“) JSX is neither HTML nor a template DSL, it simply transform into a function signature. 9 out of 10 frameworks base on the functional approach today, including Vue.
- achairapart 9y agoThey're both opinionated. Actually, every framework out there is trying to reinvent the wheel (shame on Web Component slow and still ineffective development, what a pity). I guess will stand out and prosper the one with the largest adoption (to this point, React). All this looks exactly like the old jQuery vs Mootools vs Prototype debate 10 years ago. History repeats itself.
- Geee 9y agoThanks for this. I hated Angular for the same reasons although it seemed really great at first.
- jmkni 9y agoI like opinionated frameworks. The opposite of an opinionated framework is an opinionated user-base. You ask what should I use for X (routing, state management, HTTP requests, etc, etc) and every react developer gives you a different combination of answers, and you have no good way to figure out which combination is the best. I much rather the framework answer those questions for me so I can focus on getting shit done and actually building the thing I want to build.
- jsnanigans 9y agoIt depends on your project, they are both great frameworks
- IgorPartola 9y agoThis is the most curious answer here. What factors would you weigh?
- acemarke 9y agoIt's actually a very legitimate answer. Vue and React are similar tools that solve basically the same use cases, with some technical and cultural differences. - React uses JSX and JS logic for render methods. Vue usually uses templates, although JSX is also supported. - While React _can_ be used as a plain script tag, it's usually compiled as part of a build step. Vue can be compiled, but it seems friendlier to the "drop-in script tag" approach. - The Vue community values official integrated addons for routing and state management. The React community prefers a "pick-and-choose your own adventure" approach. - Since React has been around longer, there's probably more React components and related libraries available - A larger percentage of the Vue community is located in China The best comparison of Angular, React, and Vue I've seen thus far is at https://medium.com/unicorn-supplies/angular-vs-react-vs-vue-a-2017-comparison-c5c52d620176 https://medium.com/unicorn-supplies/angular-vs-react-vs-vue-... . It lays out a lot of the similarities and differences in a fair way, and gives some suggestions for why you might pick one over the others.
- IgorPartola 9y agoSure. I am well aware of these differences. They are basically two different implementations of the same idea with two communities that do things slightly differently. What I fail to see is how I would choose one over the other for different types of projects. To me, it's a choice a person or a team makes for all projects at once. Jumping back and forth between stacks here would be a lot like jumping back and forth between Django and Ruby on Rails. They aim to solve the same thing, and if you can use one effectively then why would you reach for the other?
- overcast 9y agoVue is less complex, easy api, and easier to jump into. React is more complex, bigger learning curve, but more featured. Vue has satisfied my needs for 99% of projects.
- stefantheard 9y agoThis has been my experience as well. With react if I need something I can generally find a component someone else has already made that is well supported / decent quality. With Vue I will generally have to roll my own.
- irrational 9y agoI haven't looked at React's components (which component library would you recommend?), but so far Vuetify has all the components I've needed.
- stefantheard 9y agoI am referencing "component" as a more general term. I think Vue has support for all of the common forms/divs/etc, I was more talking about like if you wanted an extensible calendar implementation or a scalable data table implementation there are probably 10 usable components for each of these examples in React but in Vue it would be harder to find one.
- irrational 9y agoThat is exactly what Vuetify provides. There are other component libraries for Vue, but so far Vuetify has all the components I've needed. https://vuetifyjs.com/ https://vuetifyjs.com/
- tomelders 9y agoThis really boggles my mind. Having looked very closely at both (and being a react developer full time), I can not recognise this assessment. I just can't see how people can claim that Vue is simpler or easier than React. React is idiomatic javascript. Vue is it's own quirky thing that doesn't feel anything at all like Javascript to me.
- bdcravens 9y agoDepends on your criteria. At this time I feel like React has a larger ecosystem (assuming there isn't a lot of incompatibilities with v16), and there's a clear path to mobile if that's a choice. Vue seems to be a simpler programming model, and makes it easier to iteratively build. Personally I'd say don't make a choice at the beginning, but build a simple version of your app in both (say login and 2 or 3 pages) and make a decision based on that.
- ernsheong 9y agoSincerely, we should be leveraging the browser platform and increasingly build our apps on modern platform APIs (e.g. web components), instead of on a framework platform that means more bytes down the wire to do what the browser platform can already natively do. Admittedly there are tooling gaps with projects like Polymer, but these are being addressed. YouTube.com is already in production built with Polymer. So just leaving this comment here to encourage everyone to rethink the framework defaults of React/Vue in 2017.
- ernsheong 9y agoVideo here from Polymer Summit on the genesis of web components and the problem it was meant to solve (explosion of frameworks circa 2010, and slow JS apps): https://www.youtube.com/watch?v=y-8Lmg5Gobw https://www.youtube.com/watch?v=y-8Lmg5Gobw
- _Codemonkeyism 9y agoThanks to all who have replied, you helped a project succeed :-) Thanks for the downvotes to keep HN clean.
- conradfr 9y agoVue is React with some Angular flavoring (html templates) and more integrated libraries (state, router, etc). Usually not a problem but some issues on Github are in "Chinese" (not sure if Mandarin or Cantonese sorry) so not very helpful. If you want more choices for those libs (at the cost of potentially more dependency update hell) React is great and more popular.
- neolefty 9y ago(Side note: Mandarin & Cantonese have the same writing.)
- conradfr 9y agoOh, I feel stupid then. Thanks for the correction.
- tomjohnneill 9y ago(Side side note: Technically true, but most people speaking Cantonese would probably use traditional characters vs simplified characters for Mandarin)
- ngsayjoe 9y agoIf you also plan to use React Native for mobile apps then go for React.
- 19078235235 9y agoMy choice for vue over react was: I hate that facebook has basically made a new version of javascript. I don't like facebook as a company and prefer software that is made by people who aren't told "go make this" by their boss. Facebook has thrown out all of the previous approaches and just started again. This is good for things like the virtual dom, as the alternatives never worked to begin with, but bad for things like html templates, which have worked fine. The problem with combining javascript and html (JSX) is that the javascript gets in the way and you can't really see what the component looks.
- seattle_spring 9y ago> I don't like facebook as a company and prefer software that is made by people who aren't told "go make this" by their boss. If there's any huge company that gives engineers relative freedom to build what they want, Facebook is definitely it.
- m84 9y agoMobX + React > Vue ;)