DEV Community

loading...
Cover image for React vs Angular – Which One to Choose in 2021?
Pagepro

React vs Angular – Which One to Choose in 2021?

tomgrabski profile image tomgrabski ・13 min read

Video version

Not in a mood for reading? Watch the video!

Introduction

If you are planning to build a web or mobile app, and you are facing the problem of choosing between React.js vs Angular, in this article I will guide you through the differences, similarities, and some of the best use cases for both, to help you make a final decision.

However, some people say you cannot really compare React to Angular, as Angular is a full-stack MVC framework, while React is just a view library.

However, I think you can and even should compare them, as they are both ready to deliver great apps, and both are perfect technologies to support the most demanding digital business objectives.

We will also go over the benefits of React.js and Angular, a few pros and cons, and we will also make a classic head-to-head comparison.

What is React.js?

React.js is an open-source JavaScript library for building performant and visually attractive user interfaces. It combines development simplicity (thanks to small pieces of code called “components”) and a strong focus on user experience. React is the View layer of the MVC model, which gives you almost total freedom of choosing Model and Controller libraries.

Pros and cons of React.js

Now, let’s take a look at some advantages of React from a business perspective and its cons.

Pros Cons
Cost-effectiveness High pace of development
Great UX Incompleteness
Popularity
Performance
SEO-friendliness
Shortened time to market


If you want to find out more, we prepared a detailed summary of React JS pros and cons, which you can read here.

Companies using React.js

Facebook isn’t the only company taking advantage of React and its possibilities. There are a few more well-known brands, such as:

  • Airbnb
  • Instagram
  • Netflix
  • Pinterest
  • Slack
  • Udemy

However, it doesn’t mean that React is the right choice only for big brands – it’s on the contrary. You can use as little (or as much) of React as you need at the moment. For example, adding React to your website is literally a matter of one minute.

What is Angular?

Angular is an open-source framework created by Google for building web applications. While React is based on JavaScript, Angular is based on TypeScript. And unlike React, Angular is a full-fledged MVC framework so once you learn it well, you won’t need other solutions.

Angular is a result of rewriting AngularJS, which was the first version of Angular.

Important note: Google won’t support AngularJS after June 30, 2021.

Pros and cons of Angular

You already have learned about React.js pros and cons, so it’s time to find out why it’s a great idea to choose Angular (or not).

Pros Cons
Better error handling Huge size
Cleaner code than in vanilla JS Limited SEO options
Custom directives Performance
Higher performance Steep learning curve
Material Design-like interface
Seamless updates thanks to Angular CLI

Companies using Angular

  • Forbes
  • General Motors
  • Nike
  • Paypal
  • Telegram
  • Upwork

React vs Angular: Head-to-head

React Angular
Developed by Facebook Google
Programming language JavaScript/TypeScript TypeScript
Compatibility Full backward compatibility Updates needed
Data binding Both one-way and two-way bindings Both one-way and two-way bindings
DOM Virtual DOM Real DOM

React vs Angular: Comparison

React vs Angular - view library vs full stack framework

As I've mentioned at the beginning, some people say it's not really a good way to compare React to Angular, as they are both slightly different things.

But does it really matter if both are able to build great apps?

It seems like Angular is a better option, as it's a full stack MVC framework that doesn't require any additional libraries to be complete.

On the other hand, React indeed requires other libraries, but it really depends on your project objectives if that's a benefit or disadvantage. Being an independent view library, React gives you almost unlimited possibilities if it comes to building user experience, and what's more, you can also be quite flexible to choose with which libraries you want to work.

React performance vs Angular performance

DOM

React is using a virtual DOM, which means it doesn’t have to update all the HTML. He is just looking for the differences between the current and the old HTML and updating it accordingly.

Angular is using real DOM, which means it is going through the entire structure of HTML to find what there is to be changed and “mutate” the tree to apply changes.

React Concurrent Mode

According to official React’s website, “Concurrent Mode is a set of new features that help React apps stay responsive and adjust to the user’s device capabilities and network speed”.

However, they are still experimental and not a part of stable React release. Developers can try them in an experimental build.

React Fiber

A while ago (with v16 version) React changed its engine elevating the speed from “just fast” to “blazingly fast”.

More than that, React Fiber enables the priority-based update system, so you can fine-tune your renderings to make sure the most critical updates are done first. Also, you can pause and start your work at will.

Angular Ivy

As some kind of response to React Fiber, Ivy is a complete rewrite of the compiler so Angular developers can:

  • Achieve faster build times
  • Get smaller build sizes
  • Unlock new features like lazy loading of components instead of modules

React vs Angular Data binding

Both React and Angular are using both one-way and two-way data bindings. Two-way data binding means that whenever you change any element of the interface, your model state changes automatically, too.

One way data binding, on the other hand, renders the change in the interface model only after the model state is updated first. And whenever you change the UI element, the model state stays the same with no changes.

So, in the case of data binding, it seems like a draw because one-way data binding is preferred.

Mobile app solutions: React Native vs NativeScript

Choosing React allows you to use React Native to build truly native and cross-platform mobile applications. While RN uses a bit different syntax than React does, it’s relatively easy to learn it if you are already familiar with React. With React Native, you can create components and bind them in Objective-C, Java or Swift code.

Angular, on the other hand, uses NativeScript, which is a framework for building native iOS and Android apps with the use of JavaScript and Angular. 

When it comes to the performance of both applications, if they are well-written, the difference will be hard to notice.

Learning curve

Since React is a lightweight UI library, it’s much easier to learn than Angular. A list of things you have to absorb is quite short: JSX, a router library and state management library. Also, it’s necessary to have knowledge of writing components, managing internal state and using props.

Angular is not a library – it’s a fully-fledged MVC framework. Because of that, a list of things to learn is much longer than in the case of React.js:

  • TypeScript
  • Components
  • Decorators
  • Dependency Injection
  • Modules
  • Pipes
  • Services
  • Templates

And that’s just a start.

React vs Angular Popularity

The popularity of any particular programming language or web technology can be a great source of information and insights. Looking at these stats will help you with gathering answers to questions like:

  • Is this technology a serious thing?
  • Is there (and will be) demand for this technology?
  • Will it be easy to find and hire developers?
  • How big is the community?
  • What kind of help can I expect from the community?

To determine the popularity of React and Angular, I checked sites like Github, Google Trends, Stack Overflow Trends, and Annual Survey.

Stack Overflow Trends

React vs angular comparison on stack overflow trends

Most Loved Web Frameworks according to Stack Overflow 2020 Survey

React vs Angular comparison of Most Loved Web Frameworks according to Stack Overflow 2020 Survey

Since 2019, React.js lost its first place to ASP.NET Core, but it’s still at the top. Angular, on the other hand, stayed in the middle.

React vs Angular comparison of Most Wanted Web Frameworks according to Stack Overflow 2020 Survey

React vs Angular on GitHub

React on GitHub

React on GitHub

Angular on GitHub

Angular on GitHub

Google Trends: Comparison between React vs Angular in the last 12 months and 5 years

React vs Angular Google trends comparison in last five years

React vs Angular Google trends comparison in last five years


Templates

HTML

Angular is using templates based on an extended version of HTML with Angular directives. You will also have to learn a specific syntax.

JSX

With React, on the other hand, all you need is JavaScript knowledge. A JSX is a genius component made from markup and JavaScript logic in the same file. Thanks to the use of XML-like language, you can write your markup in your JavaScript code, so everything is in one place, and the code completion works better.

Testing

React uses Jest (sometimes together with Enzyme – JavaScript testing utility). Jest has a powerful mocking library, doesn’t require any configuration and is included in every React project. However, nowadays using react-testing-library is more common and practised.

Angular uses Jasmine, which outcome is considered by many as one of the hardest to read and too complicated.

React vs Angular FAQ - hard to answer

Many times, our clients are also asking quite interesting questions, that are truly hard to answer.

Some of them you can find below:

React vs Angular: Time to market

Is it faster to build an app with React or Angular?

The answer is hard for two reasons.

One - it really depends on too many factors. Like the skill of a developer, the competences of the entire team, the level of communication, team work flow, etc.

Second - even if you take a perfectly the same skilled developer and put him in a perfectly the same project with perfectly the same conditions, it's still going to be hard to say, as the delivery time may be pretty much similar.

React vs Angular: Scalability

Is it going to be easier to scale an app in React or Angular?

And again, I don't have a definite answer.

Both Angular and React have their pros and cons if it comes to scalability, but taken into account that React is better off with bigger apps, if you plan to make your app really big in the future, maybe it's better to think about the React from the beginning.

React vs Angular: How easy it is to start?

Is it going to be easier to start a project with React or Angular?

And again, no clear answer here.

If you take Angular - it has a lot of great ready-to-use tools and functionalities out of the box, which makes it extremely easy to start.

However, although React doesn't have that many ready-to-use options, it has also great, clear, and rich documentation that will guide you through and help you build the project from the scratch. It also has a great community ready to help anytime.

Conclusion and final thoughts

In general, there is no definite answer to which one is better React or Angular, as they both are able to build great apps.

Yet we can see slightly more advantages in using React, and we choose it, as we have to face projects with performance challenges more often. On top of that, we are appreciating the possibility to have total frontend freedom a lot.

Discussion (2)

pic
Editor guide
Collapse
hakimio profile image
Tomas Rimkus • Edited

Putting your opinion as fact?

  • In a lot of cases Angular is faster when doing DOM manipulation and in some cases it has faster load times:

Angular vs. Vue vs. React: Comparing frameworks by performance

A Real-World Comparison of Front-End Frameworks

  • What do you mean exactly by "limited SEO options"? Angular supports SSR and you can make your app perfectly SEO friendly.
  • Huge size? Nonsense. If you are using some huge UI component library which is just some commonJS jQuery/JS library wrapped as Angular components, of course, you'll have huge bundle, but that's not Angular's fault, it's your library's fault. If you use official Angular component library (or some other UI library optimized for Angular) and lazy loaded modules, your bundle will be small and initial loading time will be really fast even on some slow 3G connection.
  • Learning curve. I agree that starting with Angular takes more effort than React, but building any performant, complex, large scale application will require spending just as much time if not more with React since you'll have to learn to use a lot of 3rd party tools (with varying complexity and level of support) and modular application design patterns.
  • React is better for bigger apps? Care to elaborate why is that?
  • Testing. It's not true that you have to use Jasmine for testing Angular. You can use Jest as well. If you are using Nrwl Nx for initializing your app, "jest" will be used by default instead of jasmine. Also, awesome Angular testing libraries like "shallow-render" allow you to choose between the two of them.

Your whole article seems to be biased against Angular...

Collapse
devpato profile image
Pato

Companies using Angular - Google