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.
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.
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.
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.
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.
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!
How Nic Broke Into Software Engineering After Nucamp
Plus 5 tech jobs that depend on Ruby on Rails!
Everything you need to know about data science now