Angular vs React

Sahil More
6 min readAug 26, 2021
Angular and React Image

Angular vs. React: Comparing Apples and Oranges

Some people say that comparing React and Angular is like comparing apples to oranges. While one is a library that deals with views, the other is a full-fledged framework.

Of course, most React developers will add a few libraries to React to turn it into a complete framework. Then again, the resulting workflow of this stack is often still very different from Angular, so the comparability is still limited.

The biggest difference lies in state management. Angular comes with data-binding bundled in, whereas React today is usually augmented by redux to provide unidirectional data flow and work with immutable data. Those are opposing approaches in their own right, and countless discussions are now going on whether mutable/data binding is better or worse than immutable/unidirectional.

History: A short summary

First Appearances…

Angular, developed by Google, was first released in 2010, making it the oldest. It is a TypeScript-based JavaScript framework. A substantial shift occurred in 2016 on the release of Angular 2 (and the dropping of the “JS” from the original name — AngularJS). Angular 2+ is known as just Angular. Although AngularJS (version 1) still gets updates. The latest stable version is Angular 11, which was released in November 2020.

React, developed by Facebook, was initially released in 2013. Facebook uses React extensively in their products (Facebook, Instagram, and WhatsApp). The current stable version is 17.X, which is released in October 2020 and currently releasing more smaller incremental versions.

Github Stats…

The Maturity of these frameworks can be judged by the GitHub community’s response. As we see in the stats given above, the number of stars for Angular lies around 70k, whereas for React, it is around 164k.Over time, the skilled developers have taken to both of these frameworks, and any issues are easily resolved with the help of community support.

Popularity

Google Trends

Google Trends does not actually show the usage, but it shows which of the frameworks are the most talked about. It shows which of the frameworks people are curious about. React is the most talked-about framework right now, while Angular’s popularity has seen a major dip.

NPM Downloads

The React framework leads in the NPM downloads too, with it being downloaded more times than Angular. The increasing popularity of React makes it the most downloaded framework on NPM. Thus we see, the popularity of React has seen a rise since the year 2018.

NPM packages depending on…

The above graph shows the NPM packages which are depending upon each type. Here also React wins the race as we can see a sudden growth from 2019.

Technical Side

Components

The Angular framework is based on three layers, Models, Views, and Controllers. It comes with a complex and fixed structure. With Angular, the developers break down the codes into separate files, which makes it easier for them to re-use the templates and codes in other projects.

The React library doesn’t have a fixed format to write codes in. The code written using the React library is well structured and readable. The use of component trees allows the code to be logically structured. The library also has functional programming, which makes the component declarations declarative.

Performance

Performance is the most important criteria while discussing the differences between Angular and React. Document Object Model (DOM) is used for the evaluation of the performance of each of the frameworks. DOM is a programming interface that organizes the HTML, XHTML, XML documents in the form of a tree. The tree enables the scripts to interact with each other dynamically.

When using a real DOM, the whole tree behind the framework gets refreshed every time a change is made. This makes the process slower, and the framework’s performance declines. This problem is solved with the help of a Virtual DOM, that tracks the changes and ensures only specific elements are updated without affecting other parts of the tree.

DOM Tree Structure

Regular DOM vs Virtual DOM

Angular uses real DOM for its applications. For single-pages that get updated occasionally, real DOM is perfect. Also, the size of the library is huge, which makes the apps using Angular slower. For example, UpWork is one of the most popular apps that use Angular, as the need for the frequent update of the user feed is low.

React uses a virtual DOM and is best suited for pages that need regular content updates. The size of the library is small too, which makes it more lightweight and dynamic. For example, Instagram uses React as it needs the user feed to update frequently.

Data Binding

The Angular framework uses a two-way binding approach that changes the model state automatically when any change is made in the UI element and vice versa. The React library uses a one-way approach. This approach allows the change in the UI elements only after a change is made in the model state. The two-way approach seems to be easier, but React’s one-way approach is more effective for projects with large amounts of coding.

The Complete Comparison

source

What to choose ?

Angular

You should choose the Angular framework when developing a large-scale application that is loaded with various features. It gives you a reliable and scalable framework. The use of the Angular framework makes the development of real-time message apps easy. Also, teams well-versed in TypeScript find Angular easier to work with.

Advantages

  • Offers clean code development
  • Higher Performance
  • Material Design-like Interface
  • An angular framework can take care of routing which means moving from one view to another is easy
  • Seamless Updates using Angular CLI
Brands using Angular

React

Reacts are used to develop single-page and cross-platform applications with ease. They can be used to extend an app’s existing capabilities. React has made it possible for developers to make light applications that have modern capabilities in a short time-frame. React offers a plethora of advantages, one of them is the availability of tools that can be used to personalize your webpage with ease.

Advantages

  • The HTML-like syntax for which allows templating, and highly detailed documentation.
  • Developers can spend more time writing modern JavaScript, and less time worrying about the framework-specific code.
  • Enhance support for server-side rendering, making it a robust framework for content-focused applications.
  • Migrating between versions is in React.
  • Skills learned in React can be applied to Native development.
Brands using React

Hope this article was useful for you 😄
Do let me know if you want some other articles of this type here 📪

Helps me to stay awake to write 💛

--

--

Sahil More

Founder SINFORMS @sinforms.com | A software engineer who writes about some interesting facts, you’ll find me @sahilmore.vercel.app