~andreicek/

Vue.js vs. React, or - please stop the bikeshed

Tuesday, April 10, 2018

A note: views expressed here are mine and mine only. In no way this represents Infinum, but it does affect the way I teach at Infinum Academy. I take great pride in that. If you don’t agree with me - that’s fine and I would like to hear you out. Tweet at me, or email me :). The end goal is to help people.

Intro

The JavaScript community is very diverse and divided. We “fight” over bundlers, package managers, editors, frameworks, libraries, code styles, etc. the list could really go on forever. This, in part, is why we as the community and JS as a language are both perceived as immature, contributing to the thing we like to call JS fatigue, and all in all a total mess. A great deal of “hate” we owe to browser vendors and the inability to deprecate stuff, but the other part of the blame is on all of us.

I’ve been a JavaScript developer for little over three years now, with a couple of big projects behind me - on some I was just helping around, other I’m leading and making technical decisions. I’ve mentored students and colleagues, reviewed pull requests for Backbone, React, and Vue.js; and helped define Infinum’s coding style for React and TypeScript. And this blog post is my answer to the “age”-old question - should I learn React or Vue.js?

TL;DR

If you’re gonna stop reading now and comment anywhere - comment on this statement: “start with anything.” You can start with either of them or even something else (my first JS project was Backbone.js). Teach your self the basics of the language and learn to avoid the pitfalls of endless Twitter/Hackernews/Reddit debates “my framework is better than yours”.

Importance of having a stable base

While I’ll be one of the first people who preach and talk about just starting and building stuff, I’ll also be the first to back up the idea that without a base your house is unstable, and so is your JavaScript knowledge. Sounds contradicting? Allow me to explain.

Whatever you pick as your starting point, you’ll have the same problems to overcome, especially if you’re new to the whole JavaScript thing. How do I get the data to my application? How do I show that data? How do I style the data? We can have long discussions on any of this questions; axios vs. fetch, redux vs. vuex, scss vs. css. But at the end of the day the problem has to be solved, and whatever you pick I guarantee it you can apply that knowledge across the whole ecosystem.

Echo chamber

When you pick a framework to work with you undoubtedly pick a community too. You’ll probably want to follow people working on the same tool as well, maybe even listen to a podcast, subscribe to a newsletter. What you are doing is fine, really! - but understand that you are entering a huge echo chamber.

What you are also doing is perpetuating the self-generated discussions how your tools are the easiest to learn (OMG just look at how I can make a component with zero boilerplate), or even how performant your language is (0.545345ns first paint!!! #perf). What also happens inevitably is commenting on how your tools are the best! And again - all of this is normal!

But(!), you’re also never learning about other tools and what they do good or even better. And this is really bad - for you and for your community.

There is a time and a place to worry about performance and boilerplate - but that time is not when you’re just starting out.

Teaching

I have a unique position and an opportunity to help shape young JavaScript developers in Infinum’s Academy. I chose a framework (React+MobX) to work with because I know that when they start looking for a job a CV with “knows JavaScript well and in detail” won’t land them the same opportunities as “a React developer.” But what I put the focus of the Academy on is the mechanics of the language, project structure, good practices, etc. All of which are applicable to any frameworks out there.

I’m really proud of two of my past students, now colleagues and friends. Both of them started with React, but now are proficient and working with Angular and Backbone respectively. If they spent time discussing and going back and forth between frameworks, or even (and this hurts me to write) listened to influencers preaching a framework other than what they chose and then kept switching they would not be where they are now. And I’m glad to say that they are both very respected members of the JS team.

To a junior dev

Whatever you start with is fine. Also, it’s fine to start with a framework that has the cutest logo (the only reason I started learning GO). Just stick with it to the end and you’ll be able to pick up any framework that you wish later. Stop focusing on why JSX sucks, or why vuex is a terrible choice for beginners.

Spend that time building and learning so one day you’ll be able to pass that knowledge onto another person. And maybe, just maybe, we can focus more on our end users and our products a bit more instead of angry tweeting about webpack vs. fusebox, angular vs. react, …

Epilogue

Not so long ago I was also one of the people defending my choice over other. I was wrong and I’m making sure to make an effort now to invest time into understanding what the base should be. At the end of the day it’s just a tool; you can use one but don’t be one.

I have a getting started guide written over at Infinum’s blog. It still is what I think a good starting point is, and what I’ll recommend if you ask me. This blog post doesn’t change how I feel about the one published on Infinum’s blog, and vice versa.

If you liked this post consider buying me a cup of coffee.