article

React vs Angular

Imogen Crispe

Written By Imogen Crispe

Last updated on June 24, 2016

Course Report strives to create the most trust-worthy content about coding bootcamps. Read more about Course Report’s Editorial Policy and How We Make Money.

angular-vs-react-debate-turing-school

As coding bootcamps have evolved towards JavaScript-heavy curricula, the debate between frameworks like React, Angular, and Ember is fierce. But what exactly are these technologies, and what types of projects are they used for? We spoke to Turing School’s Front End Engineering program director Steve Kinney about the history of these JavaScript technologies, where they are used, and which you should learn first if you want to be a top-notch JavaScript developer.

From Ruby to JavaScript

There has been a big shift coding bootcamps’ curricula from Ruby on Rails to JavaScript. Why is that?

If you look at the state of the web, there are many different back-end server-side engineering languages. Certain companies use Python; others use PHP or Ruby on Rails. Atwood’s Law says that anything that can be written in JavaScript, eventually will be written in JavaScript. The blessing and curse of the browser on the client side is that JavaScript is the only game in town. For a language built in 10 days it has been very successful. JavaScript is an incredibly versatile language. You can build everything from web applications to mobile applications to desktop applications with one language.

JavaScript: An Overview

What’s the history of JavaScript? Is it related to Java?

In May 1995, JavaScript was conceived and built in 10 days by Netscape employee Brendan Eich, as a side language for doing very lightweight things alongside Java.

Interestingly, JavaScript was not built to be anything like Java. It was actually more inspired by two unrelated languages called Self and Scheme. The Netscape marketing department told Eich that they wanted to call the language JavaScript. When Eich said it had nothing to do with Java, they essentially said, “Make it look like Java.” That’s why the syntax is inspired by Java and C but it’s not actually related to those languages per se.

javascript-vs-java-cartoon

So was JavaScript as popular in 1995 as it is today?

Originally, JavaScript was used only in the browser for making very small changes to the content of the page, but over time, it started taking a larger role. Ajax was a huge addition, because it meant that developers could make a request to get more information from the server after the page had already loaded. This ability to fetch more resources from the server opened a lot of doors for JavaScript. It shaped the idea of the web application vs the web page, and web apps like Google Maps and Gmail started to take shape.

By 2010, JavaScript had grown quickly and was interesting, but was still only available inside the browser. In 2010, a dev named Ryan Dahl wanted to make a completely non-blocking server-side language. He basically took Google’s engine from Chrome and built a server side implementation of JavaScript – Node JS. It caught on pretty quickly.

From 2010 onwards, we saw JavaScript grow in popularity with the ability to write server-side JavaScript as well as on the client side. It’s the only language that exists on both sides of the browser at this point.

What are Angular and React?

That’s a great history of JavaScript! So why are we hearing so much about Angular and React? Are these JavaScript frameworks?

There’s a question as to whether or not Angular and React are frameworks. They’re usually included in lists of popular JavaScript frameworks, but React itself is very adamant that it’s not a framework. It definitely depends on how you ask the question.

Angular was developed by Google; React comes from Facebook. Both were developed to solve problems within their company. I believe that Angular emerged out of the Google Feedback app. In trying to manage Google Feedback, one of the engineers said, “I could build a better way to do this in two weeks.”

Facebook knows that every dip below 60 frames per second as a user scrolls, slows down the app and loses customers. Since Facebook’s main platform relies on ads, I think React was focused on doing updates incredibly fast from the beginning.

Conceptually, that makes sense. Can you give us an example of a time you would use React?

React is more like a small library for quickly rendering your user interface and managing everything that could possibly change. Changing stuff is the hardest thing to do in programming.

For example on Facebook, you have a friend request on in “notifications” and in “friend requests.” If a user accepts a friend in one place, then the app should technically not allow you to hit the button again somewhere else. So React is a library that basically handles the state of your application and ensures that it will render really quickly and make all those changes to the page.

What React doesn’t do is provide you with any of the other stuff, like how to pull stuff from your server. When using React, you can plug in a whole bunch of different things. It’s very lightweight, very easy, very fast and very small, but it’s a piece of your full application.

Frameworks like Angular and Ember give developers everything they need to use a web app.

Can you give us an example of what you would use Angular for?

If you need to pull data from the server and there’s going to be a lot of interaction and saving to a database then you’re going to need that kind of feature. If you look at Apple Music, which is currently an Ember app, it’s got a lot of robust things it needs to keep track of things like playlists. Generally speaking, you can build the same applications with either React or Angular. It’s whether or not you want to build your own tool chain or pull a complete set of tools you know are supported by a single team.

React vs Angular

At Turing School, are instructors telling students when to use a particular language/framework?

React is very small and nice because you can choose the parts that you need. On the other hand, you now need to weigh all those decisions. You need to hope that every individual piece is maintained or you need to swap it for another piece.

It’s all about the tradeoffs that you want to make when you’re building an application. There’s not a right answer on whether you should pick React or Angular.

In Turing’s Modules 1 and 2, there are right and wrong answers. As soon as you get to the professional level, I think what separates software engineering from data entry is that there are no right answers. By Module 4, students have to think critically about things and weigh tradeoffs along those lines.

We’ve heard people say that React is “killing Angular!” What shortcomings do you think Angular has that might have made room for React to start creeping in?

Angular did benefit a lot from being the first big framework on the scene. When you have no competition, you can corner the market. Since that time, Ember and React have shown up to take a piece of the pie as well. Does it mean one of them is dying? I don’t know, but it does mean there’s more than one person in the room now.

A big factor that led to the slowed growth of Angular was the transition from Angular 1 to Angular 2. I think both Ember and React have done a really good job of being perpetually backwards compatible. In Ember, you can take an application that was built in 1.0 transition into 2.0 in a day or two.

Angular 2 was a complete rewrite of Angular 1, and it’s still in beta. So developers make the decision, “do I learn Angular 1 knowing I’ll have to learn Angular 2 soon, or do I just learn React or Ember?”

If someone had to choose right now between learning either React or Angular, which one should they choose?

This is my most subjective answer, but I’d probably go for React. Being the smaller framework, the learning curve is shorter. In a framework like Angular and Ember that has more going on, you pay a lot more upfront to learn all those things. That being said, once you’ve learned it, they’re doing a lot of the work for you.

You could learn the basics of React in a week or two. If you’re a beginner, it’s a great place to start, then you can bring in each piece as you need it rather than taking on the whole 17-course buffet at the same time.

Which is your favorite of the two?

I like React, but I also like Ember. If I had to make the choice between a large framework that did everything, I would actually choose Ember. I do a lot of lightweight stuff in my own personal projects and React is a better choice for those.

React is very much like a library and it doesn’t give a lot of strong opinions on a best approach. Ember and Angular do have stronger opinions and I think those opinions form how you might build a React app as well.

Using React and Angular

As an instructor, how much time do you devote to these frameworks in the Turing School Front End Engineering program?

A big part of the 3rd and 4th modules are for Angular and React. One of the advantages of a 7-month program is that we can focus on making sure the fundamental concepts underneath all of these frameworks are rock solid. We can then spend a lot of time on them.

Are there situations where a developer would use both Angular and React?

Probably not. Angular is used to handle the rendering of the UI. Angular ties itself very tightly to the HTML that you’re writing, while React takes a separate approach. I won’t say that there is no case but I definitely can’t come up with one and would advise against it without a really solid use case.

What if I want to use JavaScript to build a mobile app? How does cross-platform development compare using React vs. Angular?

Angular has a mobile framework called Ionic which is used to build mobile apps. React Native is really cool because you’re not building a web app in the browser; it actually compiles into an iOS or Android app.

Generally speaking, choosing a language is always about which one is the fastest. JavaScript got really fast when all the major browser vendors were in a war with each other to up their performance. I think that frameworks are in that war now. React started out as the fast framework, but theoretically, Ember will get faster, then a new faster version of React will come out.

As far as mobile development goes, React has some huge advantages in that it is very, very fast. As consumers, we went from these super fast computers to much more resource-constrained mobile devices, so I think the performance focus of React is a good choice on their part. There’s also a focus of React being a smaller framework, meaning less to download. If you think of mobile connections, speed to download the entire application is really important as well.

Right now, Angular 2 is quite big, but one of their biggest priorities is to get the file size down to a small React-competitive file size.

Developers and users get the best possible tools because there’s competition- the ultimate winners are the front end developers. Some of these answers will probably be wrong in a month, which is great.

Are there particular back end technologies, which work better with React or Angular or both?

As long as you build a “RESTful” API and your API makes sense, it doesn’t really matter. Having personally built APIs in Node as well as Ruby on Rails, I still prefer to write my APIs in Rails. It’s the same set of tradeoffs; Rails gives you things like validations to make sure bad data isn’t entering your database, the ability to roll back your database between tests, etc. You can put those things together in a lighter weight system but I don’t love doing that.

I like to build the APIs in Rails but the idea is that it’s like a black box. As long as it has the APIs that developers need, it shouldn’t matter. Twitter started out as a Ruby on Rails application but as it grew to millions and millions of users, everything had to be custom-built. There’s no “off the shelf” when you get to Twitter or Facebook size. They were able to switch it from Ruby on Rails to their own custom thing and the API never changed. As long as the API doesn’t change, it doesn’t really matter.

Angular vs React II

Okay, so to sum up our conversation, in what situations is Angular the best choice?

If you just want to get something off the ground, don’t want to assemble everything yourself, and want a relatively well-vetted set of tools, I think Angular is the best choice.

The same question for React; when would you want to use React?

If you’re developing a smaller, lightweight app, you don’t need all those tools in Angular. You don’t want to pay the performance cost or the download cost. Or if you have a very special set of priorities, React is the way to go!

FURTHER READING

Find out more and read Turing School Reviews on Course Report. Check out the Turing School Denver website.

About The Author

Imogen Crispe

Imogen Crispe

Imogen is a writer and content producer who loves exploring technology and education in her work. Her strong background in journalism, writing for newspapers and news websites, makes her a contributor with professionalism and integrity.

Also on Course Report

Get Free Bootcamp Advice

Sign up for our newsletter and receive our free guide to paying for a bootcamp.

By submitting this form, you agree to receive email marketing from Course Report.

Get Matched in Minutes

Just tell us who you are and what you’re searching for, we’ll handle the rest.

Match Me