News for hackers. Stuff that matters.
Re:Why we chose Vue.js over React by welanes on Sunday December 11, 2016 @11:05AM (#13151602)
One of the most impressive thing about Vue.js was the ability of the framework to enter a field saturated with dozens of options, that was becoming dominated by a well-resourced oligopoly (Angular, React), and still win over developers jaded from Javascript-fatigue.

The give-a-shit factor from Evan (the creator) is extremely high and was key to its success.

Inspiration for anyone building a product in an established market: there's almost always room for better.

Re:Why we chose Vue.js over React by lilactown on Sunday December 11, 2016 @02:32PM (#13152691)
I think that, similar to how everyone realized that jQuery wasn't the right tool for certain problems, people are coming to the conclusion that Angular and React+[Flux/Redux/MobX/etc.] isn't always the right tool for certain problems as well. And I think that Vue.js fills the needs for those problems very well.

The truth is, the majority of the work I've done in React for my job on the web would have been much better off written in Vue. React gives plenty of rope to hang yourself with if code quality isn't kept, especially when working with developers who've done nothing but jQuery for the past 10 years.

Vue.js (which, TBH, I haven't used yet - I'm still on the React hype train) looks great when you're working on a project that is complex enough to warrant looking for something more than jQuery, but not big enough to warrant the abstractions presented by React.

I've also found that the paradigm shift from jQuery apps to React is difficult for a lot of people at first, and Vue.js looks like a nice middle ground of "still looks like plain javascript-in-the-browser" while also nurturing some of the same ideas: components, event-driven model, one way data flow.

It also requires no transpilation and has a small footprint.

All of these are IMO a great plus when working in a team environment on sites that require lots of interactivity but don't quite fit into the "SPA" bucket.

Re:Why we chose Vue.js over React by mos_basik on Sunday December 11, 2016 @03:27PM (#13153001)
You are On. The. Money.

When I first started dabbling in web programming a few years ago, I quickly learned about jQuery from SO while looking up common patterns to create the behaviors I wanted in the browser. But even accounting for my unfamiliarity with the browser paradigm, jQuery always rubbed me the wrong way because of how loosely structured it allowed you to be and the amount of leaky scope it encouraged.

I finally decided earlier this year it was probably worth my time learning a framework just to get some structure in my code, so I asked a webdev friend if he had any recommendations for a JS framework I should try; he pointed me towards Vue. I had never heard of it and was skeptical, but I started working through the quickstart guide (Vue docs are great, another +1 to Evan!) and I was hooked before I finished the third example. It was night and day from jQuery, but easy to learn. My experience so far is that Vue (in contrast to jQuery) is astoundingly flexible for how terse it is. My code was probably bad, but rewriting a jQuery page in Vue usually halved my linecount.

>no transpilation

This is huge to people who just want enough JS to get their proposed feature working and don't want their whole site to be JS, and to beginners. True, at this point I have started getting comfortable with the npm/webpack/babel/es6 stack and I enjoy the things it makes convenient - but at the beginning it's a pretty nontrivial learning curve and delayed benefit for a dev team that have probably been doing most things on the server with python or php.

>Vue.js looks like a nice middle ground... while also nurturing some of [React's] ideas

YES. My first three tries in Vue were basically little calculators that hit some APIs and got some user input and displayed data. I had no idea what "components" were and my calculators were quick to write and worked great. I figured that if I ever needed to use components, there was time enough to learn about them later.

A month later, I decided to dig in and grok React. After a couple of good tutorials, I finally get components and why they can be great. I've never used Vue's component system, but now I have faith that they are as much a pleasure to use as the rest of it.

The great thing about Vue is that it's modular. It can be as simple or as powerful as you need. If you just want to define some behavior and have an object with standardized access to hold the state of your page, you can do that. If you want to use portable components to reduce duplication of effort, you can do that. If you want to enforce Flux design, vuex[0] is there for you. If you want to write a full SPA and need a router, vue-router[1] will do it. If you want to use JSX, there's a Babel plugin[2] for that. None of these are around to complicate your understanding of things when you're learning, but they are easy to plug in when you need them. This is in pretty strong contrast to my experience with React, where you get hit with a lot all at once. Admittedly, I jumped quickly into using Redux and websockets because I was using that one great tutorial that everyone links[3] - so maybe React by itself isn't too overwhelming. I won't hold my breath though.

[0]: https://github.com/vuejs/vuex

[1]: https://github.com/vuejs/vue-router

[2]: https://github.com/vuejs/babel-plugin-transform-vue-jsx

[3]: https://teropa.info/blog/2015/09/10/full-stack-redux-tutoria...

Re:Why we chose Vue.js over React by welanes on Sunday December 11, 2016 @07:06PM (#13154391)
> I've never used Vue's component system

Once components click, everything becomes a component.

That's not a two-bit attempt at Javascript zen, what I mean is that components are basically reusable building blocks of functionality. Mastering them provides an excellent way to reason about your app's structure.

Re:Why we chose Vue.js over React by orange888 on Sunday December 11, 2016 @04:05PM (#13153207)
Vue is a frontend framework. jQuery is a library, with a very specific goal (DOM access)

What happened when you were using jQuery, is you created your own homegrown "framework" on top of it. Thats what you should be comparing Vue with, not jQuery.

Re:Why we chose Vue.js over React by mos_basik on Sunday December 11, 2016 @04:38PM (#13153447)
I don't deny it. What surprised me was that Vue, a framework, was easier to learn than jQuery, a library.

In my experience elsewhere it's usually the other way around. Like learning how to use Python's Requests vs. learning how to use Python's Flask.

Re:Why we chose Vue.js over React by orange888 on Sunday December 11, 2016 @05:09PM (#13153660)
Once again: apples and oranges
Re:Why we chose Vue.js over React by aikah on Sunday December 11, 2016 @02:53PM (#13152796)
> One of the most impressive thing about Vue.js was the ability of the framework to enter a field saturated with dozens of options, that was becoming dominated by a well-resourced oligopoly (Angular, React), and still win over developers jaded from Javascript-fatigue.

When it comes to simple solutions that do no require a build step, the field is not that crowded. A built step should be optional, not necessary to use a front-end library. With Angular you start with the CLI, with React you need to compile JSX files, ...

Angular 1 didn't succeed because it needed a build step or a third party language, it succeeded because it provided a smooth upgrade path from jQuery based apps. The Angular team forgot what made Angular popular with their "enterprise framework".

Re:Why we chose Vue.js over React by irrational on Sunday December 11, 2016 @03:03PM (#13152855)
Is that true? I mentioned somewhere else that being able to use vue.js without a compile step was a breath of fresh air, but I was informed that you can also use React as a drop in library without any kind of compile/transpile/task runner. I assumed the person knew what they were talking about, but I never to research it. So now I wonder what is true. Can react be used as a drop in library like vue.js?
Re:Why we chose Vue.js over React by jasoncchild on Sunday December 11, 2016 @03:35PM (#13153044)
So long as you don't use JSX you certainly never need to transpire. I believe there is also a shim to do client side jsx parsing but is not encouraged for use with prod code
Re:Why we chose Vue.js over React by lilactown on Sunday December 11, 2016 @03:30PM (#13153021)
It certainly can, but the current mindshare is certainly against that (for various reasons). JSX can be used with just dropping in a second library, but performance is impacted (it has to do the compilation on the fly). If you want to use the ES2015+ features of React, you'll need a build step in between due to lack of browser support.
Re:Why we chose Vue.js over React by devoply on Sunday December 11, 2016 @11:27AM (#13151741)
The reason for its success is good documentation and simplicity. Anything like this aims to empower users, and get the fuck out of the way and let them do their work has a space no matter how crowded the market.

Angular and React want you to do things their way and therefore get in the way, and then make you do a bunch of work to make things work their way. I have a PHP app that I rigged up using Vue.js. Took two days to do. Had to change nothing in the app, instead of rendering views with PHP they are output using JSON simple enough. Powerful. Can't do that with Angular for sure. Don't have time to deal with react and its nuances.

Re:Why we chose Vue.js over React by stephenhuey on Sunday December 11, 2016 @05:26PM (#13153760)
This, a thousand times this. I strongly considered Vue for a recent project but needed a bit more and went with Aureli, and now that it's out of beta I hope they keep up their rapid improvements to the docs to win over people with simplicity in getting up and running with Aurelia.
Re:Why we chose Vue.js over React by kentor on Sunday December 11, 2016 @02:01PM (#13152512)
What does "want you to do things their way" even mean? Aren't you doing things a certain way by virtue of using a framework? Maybe angular/react is just making you do things in a way that you prefer not to, while vue.js is making you do things in a way that you find reasonable. For other people, it's the reverse.
Re:Why we chose Vue.js over React by a-real-dinosaur on Sunday December 11, 2016 @02:20PM (#13152626)
If you have to do things in a specific way, then you are forced to learn that at the same time as you are learning the technology. Learning just vue on the other hand, is much easier when you can retrofit your existing knowledge into it. Then worry about the 'proper way' later when you have made your first few apps. I already have boatloads of knowledge, and whilst it may not be '2016', it's been good enough for the past 5 years.

React on the other hand, whilst it gets described as 'just the view', but I haven't seen a single tutorial that uses anything other than React/Redux to drive it.

To even get started in React, you need a babel, npm, gulp or webpack, node and a data-store of your choice. On top of this, any of the tutorials you can find from a full-stack perspective get made obsolete within months. This is javascript fatigue, all you have to do is look at this recent article.

https://www.fullstackreact.com/articles/react-tutorial-cloni...

It makes me wonder how many 'npm install' developers actually understand what is happening under the hood. This is not worse than the DOM ignorance that jQuery causes IMHO.

Re:Why we chose Vue.js over React by ng12 on Sunday December 11, 2016 @04:26PM (#13153375)
> To even get started in React, you need a babel, npm, gulp or webpack, node and a data-store of your choice

This is patently not true. You don't need any of that to make a React app -- you can just download the min.js files and get coding. React is perfectly capable of handling it's own state management and webpack/babel/npm are just to make your life easy. The problem is people follow full-stack, real-world tutorials like the one you linked without first just learning React.

Re:Why we chose Vue.js over React by joshmanders on Sunday December 11, 2016 @02:56PM (#13152818)
> React on the other hand, whilst it gets described as 'just the view', but I haven't seen a single tutorial that uses anything other than React/Redux to drive it.

As a former Angular dev gone React, I've been able to accomplish 90% of what I could do in Angular, using React, React Router and Fetch API.

> To even get started in React, you need a babel, npm, gulp or webpack, node and a data-store of your choice.

Create React App allow you to forget about that stuff and just worry about your app. Same with Next by Zeit, and there are plenty of other things including a couple of CDN backed script tags you can throw on any html page and start using React right away to get started.

> On top of this, any of the tutorials you can find from a full-stack perspective get made obsolete within months.

That's because all these boilerplates or tutorials are pushing a style of developing React apps in which that specific person finds the best way.

> This is javascript fatigue, all you have to do is look at this recent article.

JavaScript fatigue is result of lacking knowledge of the basis of the JavaScript language and feeling you need to use the next greatest shiny framework and misunderstood boilerplate to "get up and running quickly" with said new shiny without a grasp of the tools used causing them to break and you not knowing how to fix it.

React uses JavaScript that everyone should know and be able to apply to anything else to do stuff.

You're not extending a special snowflake "class" system that requires you to do things drastically different from previous "class extending libs"

Because of this, tools like Inferno and Preact can prosper and allow users to literally swap out using React for Preact in production just by setting an alias in Webpack.

There's no special snowflake syndrome, JSX is just a syntax ontop of JavaScript to make it feel like we're writing HTML (with a couple caveats), but you don't need to use JSX. You can accomplish the same thing writing React.creatElement calls, as it's just props all the way down.

JSX is also compiled at build time, and not at runtime. You may think this is a problem, but lets be perfectly honest, most people already use tools like SASS/LESS and have a build step in their workflow already, adding another one isn't complicated.

Re:Why we chose Vue.js over React by spion on Sunday December 11, 2016 @03:17PM (#13152947)
Try looking for react + mobx tutorials.
Re:Why we chose Vue.js over React by agumonkey on Sunday December 11, 2016 @03:36PM (#13153046)
Maybe it's origins too. React and Angular are massive and high marketing products. The viral spread is organic but not self emergent, unlike vue where users kept going back to it and talk about it naturally; because it's "good enough" and more humane in it's structure and interface.
Re:Why we chose Vue.js over React by jonaf on Sunday December 11, 2016 @12:46PM (#13152114)
Is there a Vue Native project of some sort? Currently planning on using React for a new project strictly because I can use the same components for a native app on multiple platforms.
Re:Why we chose Vue.js over React by mcudich on Sunday December 11, 2016 @01:25PM (#13152313)
Re:Why we chose Vue.js over React by amenod on Sunday December 11, 2016 @03:14PM (#13152916)
Not Vue based though, if I understand correcty?
Re:Why we chose Vue.js over React by jeffjose on Sunday December 11, 2016 @12:55PM (#13152156)
Check out Weex
Re:Why we chose Vue.js over React by amenod on Sunday December 11, 2016 @03:14PM (#13152924)
Also not Vue based, right?

Link for lazy & curious: https://alibaba.github.io/weex/

Re:Why we chose Vue.js over React by EvanYou on Sunday December 11, 2016 @05:34PM (#13153803)
The Vue-based version is already in good progress and we plan to ship a beta early 2017: https://github.com/weexteam/weex-vue-framework/issues/9
Re:Why we chose Vue.js over React by peller on Sunday December 11, 2016 @03:22PM (#13152979)
Technically not yet, but from the official Vue 2.0 release announcement:

> we have started an official collaboration to make Vue 2.0 the actual JavaScript runtime framework for Weex. This will enable users to write universal Vue components that can be reused across Web, iOS and Android! The collaboration is still in early stages, but it will be a big focus for us now that 2.0 is out, so stay tuned!

https://medium.com/the-vue-point/vue-2-0-is-here-ef1f26acf4b...

Re:Why we chose Vue.js over React by shams93 on Sunday December 11, 2016 @03:55PM (#13153138)
He also has wonderful documentation, and the framework itself makes it easy to move code over from angular 1.x. The give a shit factor is huge when you look at the quality of documentation and the website organization. Just telling people to "read the code" doesn't cut it, Even hit a home run with the quality of his project website and documentation.
Re:Why we chose Vue.js over React by jaequery on Sunday December 11, 2016 @12:28PM (#13152035)
Basically React seemed immature, as if it wasn't thought out fully but just hacked together.

Vuejs seems like what React could've been if it was thought out a Bit more. It just feels a lot more polished.

Honestly I think Vue is so far ahead of the curve it isn't a surprise to see more people switch away from React.

Re:Why we chose Vue.js over React by danabramov on Sunday December 11, 2016 @01:42PM (#13152402)
I wouldn’t say React is “hacked together”. Perhaps you are referring to the React ecosystem? Facebook doesn’t build single-page apps with React, so naturally it doesn’t provide solutions for routing and similar concerns, so there is more churn as people are figuring this out together.
Re:Why we chose Vue.js over React by keyanzhang on Sunday December 11, 2016 @06:20PM (#13154094)
Re:Why we chose Vue.js over React by simonw on Sunday December 11, 2016 @02:55PM (#13152812)
Could you expand more on "Facebook doesn't build single-page apps in React"? I hadn't heard that before.
Re:Why we chose Vue.js over React by lucasmullens on Sunday December 11, 2016 @04:35PM (#13153432)
Like, facebook.com isn't one big single-page React app. They use it for specific pages/features.
Re:Why we chose Vue.js over React by irrational on Sunday December 11, 2016 @03:05PM (#13152867)
Wait, do people use React for non-SPA websites?
Re:Why we chose Vue.js over React by tnjm on Sunday December 11, 2016 @07:06PM (#13154392)
I use React all the time for individual components on server-rendered pages. It feels like a natural extension to formerly monolithic Rails/Node/etc apps.

That said, when an SPA is called for I'd far rather use Ember and get routing, state and a hundred other things for free, without needing to bolt together an entire front-end framework from parts each time.

Re:Why we chose Vue.js over React by phpnode on Sunday December 11, 2016 @04:02PM (#13153192)
Of course, hence the focus on server-side rendering. It is quite difficult to do properly though. Facebook itself is not a single page application.
Re:Why we chose Vue.js over React by Ralfp on Sunday December 11, 2016 @03:59PM (#13153175)
Yep! I find myself using React.js for complex forms/wizards on non-SPA websites far more often than using it to build SPAs.
Re:Why we chose Vue.js over React by ioseph on Sunday December 11, 2016 @06:20PM (#13154095)
Absolutely! I'm current using it for a entirely back-end routed Symfony app. It's perfect for any front-end stuff complex enough that jQuery would become a mess.
Re:Why we chose Vue.js over React by ng12 on Sunday December 11, 2016 @04:20PM (#13153334)
I completely disagree. Vue seems like a step backwards for me -- it does very little that I couldn't do with Backbone/Marionette. I don't want templates, I don't want data-binding, and I DEFINITELY don't want opaque directives in my HTML.
Re:Why we chose Vue.js over React by inglor on Sunday December 11, 2016 @11:07AM (#13151612)
VueJS is pretty old, old enough to be there when React and Angular were just emerging as viable options.

It's great, and I'm grateful for it being around and for Evan's contribution but I think it was pretty lucky timing wise.

Re:Why we chose Vue.js over React by welanes on Sunday December 11, 2016 @11:27AM (#13151736)
A good place to start a comparison is when using Vue.js in production looked viable - the October 2015 V1.0 release. At that point Angular has amassed 46k github stars, React had 35k.

Star counts don't tell us everything but they're an OK heuristic of how many people are invested in a library at a point in time. Had Vue.js been in anyway meh it wouldn't have made such a dent in people's attention.

Timing luck, insofar as it exists, is probably weighted towards arriving later. Vue had a chance to listen to the market and solve some of the headaches that developers were voicing about incumbents. V2.0 is basically the best bits of Angular and React.

Again, lots of lessons for product creators.

Re:Why we chose Vue.js over React by inglor on Sunday December 11, 2016 @11:39AM (#13151804)
At that time React wasn't V1 either. Vue was used and adopted well before 1.0, I had apps for it in the v0.10 days.
Re:Why we chose Vue.js over React by ceejayoz on Sunday December 11, 2016 @11:18AM (#13151677)
Angular was released in 2010. Vue was released in 2014. Bit weird to call it "pretty old", and Angular was well established by then - they announced the v2 preview around the same time.
Re:Why we chose Vue.js over React by enraged_camel on Sunday December 11, 2016 @11:25AM (#13151723)
>>Vue was released in 2014.

That makes it pretty old. This is JavaScript we're talking about. :)

And Angular 2 is different enough from Angular 1 that it might as well be brand new. So I think the OP's comment is valid.

Re:Why we chose Vue.js over React by inglor on Sunday December 11, 2016 @11:25AM (#13151727)
2014 was the year Angular "really took off" and 2015 was the year React "really took off" (at least, if we trust "Google Trends")

Vue is, in its core, very similar to Knockout (which I think is pretty swell). I think coupled with a better DOM abstraction (like React) it can do great thing - that's what MobX does and why I like it.

I sympathize with the post's sentiment of giving UI people work.

Re:Why we chose Vue.js over React by moogleii on Sunday December 11, 2016 @11:47AM (#13151842)
It was around, but I don't think it was as mature. At the time React was becoming viable, I recall the VueJS api being pretty unstable (e.g. functionality being added in, then removed, then added back in, basic patterns being completely changed, etc).