Blog | Imaginary Cloud

Angular vs React: a comparison of both frameworks


As technology booms exponentially, so does web development.

When you think of the JavaScript Ecosystem, Angular and React will pop up almost immediately in your mind as they're considered two of the most popular Front-end development frameworks. But how to choose between both? Should you look first at the project requirements to make an accurate decision? Or take into consideration its popularity and ramp-up time in an early stage?

To help you find an answer to these questions, I will share with you my recent personal experience. I built a Front-end for the same application in both frameworks that allowed voting on which games to buy for the PlayStation 4 that we have at Imaginary Cloud's Lisbon office.

Based on my experience with Angular vs. React, and to clarify your doubts or questions, I will compare these frameworks in terms of popularity over time, main differences between them, learning curves, and their overall enjoyability.

Table of contents

What is Angular?
What is React?
Angular vs React: which one is more popular?
    ➤  Angular vs React: main differences
    ➤  Angular vs React for mobile
About the project
Angular vs React: which one to learn?
Angular vs React: which one is more fun to work with?
Angular vs React: which one to choose?
Conclusion
FAQ

What is Angular?

Angular is a web framework developed and maintained by Google that was released under the name of AngularJS back in 2010. At the time, it became one of the most popular web and JavaCcript frameworks. This was mainly due to its features like two-way data binding and dependency injection, and of course by being backed by a tech giant.

Why use Angular?

  • Modularity: Angular uses a modular architecture that enables developers to break down complex applications into smaller, reusable parts, making code more maintainable, testable, and scalable.

  • TypeScript: Angular is built with TypeScript, a statically-typed superset of JavaScript that adds features like classes, interfaces, and type checking to help developers catch errors early, improve code readability, and facilitate code maintenance.

  • Performance: Angular provides features like lazy loading, ahead-of-time compilation, and tree shaking that help optimize application performance, reduce load times, and improve the overall user experience.

  • Cross-platform: Angular is a cross-platform framework that supports building web, mobile, and desktop applications using a single codebase, making it easier for developers to build and maintain applications across multiple platforms.

  • Community: Angular has a large and active community of developers and contributors who provide regular updates, bug fixes, and new features to the framework, making it a reliable and future-proof choice for building modern web applications.

Disadvantages:

  • Performance overhead: Angular has a larger file size and more complex architecture than other frameworks, which can result in a higher performance overhead for smaller applications.

  • Opinionated approach: Angular follows a more dogmatic approach to development, which can limit flexibility and make it harder to integrate with existing codebases or frameworks.

  • Debugging: Debugging Angular applications can be more challenging than other frameworks due to the framework's complexity and its use of TypeScript.

  • Migration: Migrating from older versions of Angular to newer versions can be complex due to the significant changes in the framework's architecture and APIs.

Who uses Angular?

  • Microsoft Office
  • Deutsche Bank
  • Mixer
  • Santander
  • Gmail
  • Forbes
  • UpWork
  • PayPal
  • Grasshopper
  • Samsung
  • Delta
  • Overleaf

What is React?

In 2013, React became an open source JavaScript library supported by Facebook. This framework popularized a concept in web development known as component-based architecture with React components.

React quickly took the market by storm and overshadowed most of the frameworks at the time, including AngularJS. Therefore, in 2016, Google upgraded it’s JavaScript framework as a consequence of the community’s enthusiasm with the component-based architecture: they called it Angular2.

Why use React?

  • Reusability: React is a widely adopted JavaScript library for building UI components that can be reused across different parts of an application, leading to more efficient and scalable development.

  • Interactivity: React makes creating dynamic and interactive user interfaces easy, allowing developers to update and render data in real-time without reloading the page.

  • Performance: React uses a Virtual DOM (Document Object Model), which optimizes the rendering process by only updating the necessary parts of the DOM, resulting in faster and more efficient updates.

  • Community: React has a large and active community of developers, which provides a wealth of resources, libraries, and tools that can be used to extend and enhance the framework's functionality.

  • Reliability: React is used by many major companies and websites, such as Facebook, Instagram, and Airbnb, underscoring its reliability and scalability for building large-scale applications.

  • Customizability: React is highly customizable, which allows developers to tailor the framework to their specific needs and integrate it with other libraries and technologies as necessary.

Disadvantages:

  • Boilerplate code: React requires developers to write more code than other frameworks, which can lead to more boilerplate code that must be maintained.

  • Fragmentation: React has a large and growing ecosystem of tools and libraries, which can lead to fragmentation and compatibility issues between different packages.

  • Not opinionated: React is a library rather than a full-fledged framework. It doesn't provide strict guidelines or opinions on structuring an application, leaving developers to make many decisions independently.

  • Tooling: While many excellent tools and libraries are available for React, setting up and configuring a development environment can be complex and time-consuming.

  • SEO challenges: Since React is a JavaScript library, optimising search engines and ensuring that search engines can correctly crawl and index your content can be more challenging.

Who uses React?

  • Facebook
  • Instagram
  • Netflix
  • New York Times
  • Yahoo! Mail
  • Khan Academy
  • WhatsApp
  • Vivaldi Browser
  • Codecademy
  • Dropbox

Angular and React: which one is more popular?

Before deciding on which framework to use, it’s wise to look at its popularity. The bigger and active a community is, the quicker it gets to find a solution for any unexpected problem that comes in your way. According to the data I was able to gather at the time of writing, different results arise in terms of how popular each framework is overtime. So what's the difference between Angular and React?

On Github, while React’s repository has 207k stars, Angular had nearly 88.1k stars. This shows that both have a very large community behind them, as they stay on the top of the most starred repositories.

Another interesting topic is the number of npm (Node Package Manager) downloads.

As we can see in the above chart, React has more npm downloads than Angular since 2015. The number continues to grow, contrarily to Angular, which tends to stagnate.

Source: Stackoverflow 2022 survey


If we look at Stackoverflow 2022 survey, we can observe that, regarding web frameworks, 42.6% of the respondents prefer React, while 20.3% use Angular instead. Further, this survey also illustrates that, despite being one of the most popular web frameworks, Angular is also considered the most dreaded one. In fact, Angular has more questions tagged than its rival. This might be explained because, in general, one can find Angular more complex than React. However, I didn't experience any trouble finding answers to the doubts or questions that came up, either for Angular or React.

Source: Hacker News Tech Tools Trends


If we look at the above chart, we can see that Angular was ahead of React, in terms of the job market, until the end of 2015. At the time, Angular was a mature framework while React was still a new technology. More recently, with rampant popularity, React surpassed Angular.

This can be explained by a few factors such as:

  • React became older and developers began to dominate this technology.

  • React has a shorter ramp-up time, as it’s less complex than Angular.

  • React is more suitable for startups because it has less development time.

In summary, although React is more favored, we can see that both are very popular.

Angular and React: the main differences

Although both frameworks use component-based architecture and share many similarities, they also differ in many ways.

For you to have a clearer idea of what the main differences are, I brought up the table below. Let's take a closer look:

Technology Angular React

Purpose

Full fledged Framework - offers strong opinion on how your application should be structured and has many small libraries built-in that helps you build complex applications.

Library - only cares about View on MVC architecture, need Flux to implement this architecture, but gives you more freedom the way you want organize the code.

Data binding

Two-way data binding - meaning that if we change the input in the user interfaces (UI) it will change the model state and vice versa.

One-way data binding - meaning that an UI element cannot change the state of a component.

Language

TypeScript - superset of JavaScript and statically typed language.

JavaScript XML (JSX) - can be written in TypeScript, although not included natively.

UI Components

Integrated Material Design Components - Angular provides various material design components, allowing an easy UI configuration.

Material-UI Library & Dependencies - UI tools are developed by the community and offer a huge variety of UI components.

Dependency Injection

Supports dependency injection - which allows it to have distinct lifecycles for different stores.

Does not entirely support dependency injection - React has a global state for all the components.

DOM

Incremental DOM - when creating the new DOM it will compare with the previous one and apply the differences to the “real” DOM, only allocating memory if necessary.

Virtual DOM - whenever the DOM changes it will create a new virtual DOM, compare with previous one and only modify the “real” DOM where it differs.

Learning Curve

Harder to learn - has a lot of concepts and syntax to learn.

Easier to learn - not as difficult since it has all the component's code in the same file

Performance

Slower Performance - the "Real" DOM and bidirectional data binding process make Angular's performance slower than React. However, it may change with the addition and improvement of Ivy, a new technology .

Faster Performance - the virtual DOM trees do not overload the browser. Plus, the unidirectional data binding process reduces the workload.

Tools

Does not require additional libraries - integrates several functions, but can use NgRx and RxJS.

More dependent on a state management library - libraries such as Helmet, Redux, and React Router can optimize the state management processes, the interaction with the API, and routing.

Purpose

On the one hand, Angular consist of a full fledged framework for software development. Thus, it does not usually require additional libraries since functions such as data binding, project generation, component-based routing, dependency injection, and form validation are included in Angular's package. Moreover, Angular offers a strong opinion regarding the application's structure. Plus, it provides various built-in small libraries, which can be particularly useful when building complex applications.

On the other hand, React is a framework for UI development. Therefore, apps written with React require the implementation of additional libraries. Consequently, using React gives more freedom to organize the code as one wishes. However, it mainly cares about View on MVC architecture and needs Flux to implement this architecture.

Data Binding

Data binding consists of the data synchronization process between Model and View. Angular uses a bidirectional data-binding process and mutable data. This means that when changes in the UI's input occur, then the model state will also change and vice-versa.

Contrarily, React works with a unidirectional (or one-way) data-binding process. Thus, a UI element modification does not change the state of a component, which can improve the debugging process.

Language

Angular can use TypeScript, a superset of JavaScript and a statically typed language. In TypeScript, typos are easier to spot and overall, the code is easier to navigate.

React can be written in JavaScript ES6+ combined with JSX script, which consists of an extension for syntax, making a JavaScript code identical to HTML. In order to compile the JSX code in a browser, React can be augmented with a code translation tool (e.g. Babel). Further, React can also be written in TypeScript, but it is not included natively.

UI Components

Angular provides various material design components, with diverse layouts, buttons, pop-ups, and so on. This allows for a seamless and fast UI configuration.

When using React, it is necessary to install Material-UI Library & Dependencies to use the material design components available. These UI tools are developed by the community and offer a huge variety of UI components (with both free and paid options).

Dependency Injection

Dependency injection is a programming technique used when classes receive references to other classes (dependencies). Unlike React, Angular supports dependency injection, which allows it to have distinct lifecycles for different stores. Instead, React does not entirely support dependency injection, having a global state for all the components, which does not comply with data immutability and the concept of functional programming.

DOM

If a DOM (Document Object Model) is new to you, take a sneak peek at our Vue.js vs React blog post, where we explain the DOM in a more detailed way. Long story short, DOM is a graph representing the current view that a user is seeing in the browser. Web developers manipulate DOM to change what users are seeing, but these manipulations are costly in terms of performance. That’s why both frameworks try to minimize the cost of these operations, optimizing the way the DOM re-renders the view after an update.

Truth be told, both frameworks use DOM. However, while Angular uses a real DOM, React uses a virtual DOM. In Angular's case, when a modification is made, the entire tree structure updates. Nonetheless, Angular compensates for its disadvantage by using change detection in order to identify components that require alterations. On the other hand, using a virtual DOM, React can implement changes in a single element without updating the entire tree structure.

Performance

React seems to have an edge over Angular in runtime performance due to the Virtual DOM trees, which are built on server and very lightweight, thus not loading the browser much. Further, with React, the data-binding process is unidirectional, meaning that bindings are not assigned watchers, and consequently, the workload is reduced.

The same does not happen with Angular. Since it has a bidirectional data binding process, each binding requires a watcher to track modifications, and each loop remains until all the watchers (and respective values) are confirmed. Therefore, Angular's performance might be negatively impacted by the bidirectional data binding process. However, it may change with the addition and improvement of new technology Ivy to Angular.

Tools

From what we can see, Angular has different features than React. Also, React is more dependent on a state management library. In that sense, libraries such as Helmet, Redux, and React Router can optimize the state management processes, the interaction with the API, and routing. Contrarily, Angular does not require additional libraries and integrates several functions (e.g. data binding, project generation, and component-based routing) in its package. However, if wished, it can use the help of state management libraries (such as NgRx and RxJS) to improve its features.

Angular or React for mobile

At the beginning of this decade, smartphones boomed. Linked to that, emerged the need to make web apps adaptable to smaller screens, via responsive UI. This presented a challenge to those technologies, as they need to facilitate mobile integration and simultaneously allow developers to continue to use a tech-stack that they are already familiar with.

These frameworks ease code reusability, between web and mobile applications, and they can offer a great runtime performance almost as good as native applications.

Both Angular and React offer cross-platform mobile application frameworks, although in Angular we don’t have official support for mobile app development.

While in Angular the most popular platforms to build mobile applications are Ionic and NativeScript, in React there’s an official framework supported by Facebook which is React Native. I have to mention that React Native takes the spotlight in this. Besides being the most used for mobile, its performance is also the closest to native applications.

About the project

Here at Imaginary Cloud we take our lunch breaks in a fun way! We’ve mentioned it before, but just in case you’re only landing here now, we have a PlayStation 4 in our Lisbon’s office and we make the most of our free time playing some games. Chill moments matter, right? But this led us to an issue: with so many opinions divided, how could we decide on which games to buy?

After some brainstorming, we decided to create a small website that could allow us to add game suggestions and upvote our favorites. This would make our lives easier as we could track the most popular ones. Since I was keen to learn how they differ in implementation, I decided to build it in Angular and React.

As an intern, my previous experience was mainly with vanilla JavaScript, HTML and CSS, so yes, I had to learn both frameworks from scratch.

I had a RESTful API capable of communicating with the front-end through REST requests, sending responses in JSON.

This application had the following requirements:

  • Authentication methods

  • CRUD operations over models.

  • List and filtering data

Angular or React: which one to learn?

I know what you’re thinking: learning something from scratch can be overwhelming, especially if you feel that your background can't provide you with great support. Worry not, I felt that way too.

At first, dealing with a component-based architecture was a bit of a hassle as I never worked with it before. Notwithstanding, once I started to grasp and dived deeper into it, it became way simpler and more straightforward than I expected.

Some research was definitely necessary in order to decide which framework to use first. Spoiler alert: I decided to start with React. We’ll get there in a minute, but first, let’s take a look at Angular.

Is Angular easy to learn?

When I started with Angular I found it trickier to work than React. Angular has a lot of concepts and syntax to learn. However, its tutorial played a big part in accelerating that ramp-up process once I started building my application.

Angular’s documentation is much longer, as it has more built-in libraries and functionalities because Angular tries to solve more problems than React. I also found that Angular is much more verbose, as it has a more boilerplate code.

Also, I took advantage of many libraries that Angular provides. For instance, Angular/material, that lets you have complex components without the need to implement them and that’s inspired by Google Material Design. I also used Angular/router, to keep my UI in sync with URL.

In Angular it’s uncommon to use CSS inside JavaScript, as it already has the component CSS file, so I didn’t need to search for any libraries to apply a style to my components.

When using Angular/common/http, I experienced some issues. It wasn’t letting me create authenticated requests, as it wasn’t setting Cross-Site Request Forgery (CSRF) in the request header. I researched a lot and tried to find a solution for this, but due to Angular’s poor documentation for this module, I just couldn't. From what I've seen, it is very common to have this issue with this library. Since the suggested solutions I was able to find on the Internet weren’t successful, I used Axios instead. It was quite easy to set up as I worked with it before in React’s application.

I also used a state management library in Angular to help me manage my application state. That allowed me to have more control over the application making it easier to detect errors. I chose to use NgRx, which is very identical to Redux making the transition smoother.

Summarizing, I used the following libraries in Angular:

  • Axios,to integrate with REST API

  • Angular/router, to change the UI whenever URL changes

  • NgRx, to manage the state of my application

  • Angular/material, to create complex UI elements



Is React easy to learn?

To start, I needed to learn the new syntax that React brings: JSX. Honestly, I didn't find it difficult as I liked the concept of having all the component's code in the same file.

One of my first struggles was how to make REST requests to the back-end. For that, I decided to use Axios.

Then, I began to wonder how I would render content according to the URL. This is very common in Single-Page Applications (SPA’s) and to solve this I needed a router. Having this in mind, I decided to go with the standard React routing library, which is React Router. It has a very good example on their website and I didn’t have trouble working with it.

Also, because React only cares about the View, my application wasn’t reactive. In the beginning, I wasn’t familiar with this type of problem, as I only worked with Model-View-Controller (MVC) frameworks. Then I discovered Flux: an architecture that Facebook invented to solve this problem. Basically, it promotes unidirectional data flow, through a store that saves the current state of the application - an action that is a request to change the application state and a reducer to perform this request.

To implement this architecture, I found Redux. Learning how to configure and use it was definitely the most difficult thing while working with React.

I wanted the website to look appealing, but as it wasn’t the core of the project, I used Material-UI, a library similar to Angular/material. Their documentation is huge. Fortunately, I didn't need to dig too deep to make it work.

I also chose to use Styled-components that lets you export stylish components easily. This library has a very simple syntax and makes components more readable when comparing with React inline styling.

Summarizing, I used the following libraries in React:

  • Axios, to integrate with the REST API

  • React-Router, to change the UI whenever URL changes

  • Redux, to manage the state of my application

  • Material-UI, to create complex UI elements

  • Styled-components, to apply CSS to components easily

Angular or React: which one is more fun to work with?

Is Angular fun to work with?

Angular has really good and long documentation and many features built-in, that lets you build complex applications without searching for any third-party packages. However, it has a much steeper learning curve, which leads to a longer ramp up time. Programmers who come from traditional statically typed OOP languages like C++, C# or Java might have more fun working with Angular, because TypeScript has a similar syntax to those languages.

Is React fun to work with?

Considering its simplicity and the syntax of JSX (that I do prefer), I certainly had a better time developing in React rather than in Angular. Despite the fact that in React, you need to learn many third party packages to build a complex application (which you may find boring) and that the documentation is much shorter, it has great quality with tons of examples. Also, according to the 2019 Stackoverflow survey, developers heavily favor React as one of their most loved frameworks, explained by its easier learning curve.

Angular or React: which one to choose?

Based on my research and in the project developed, I can state that:

  • Angular allows you to detect errors in compile-time, as TypeScript is a statically typed language, instead of runtime (like in JavaScript).

  • Programmers that come from statically typed languages tend to prefer Angular as a framework, as TypeScript lets you have explicit types in your code.

  • Angular ensures that data is always sync at all levels, with the two-way data binding, that contrasts with one-way data binding of React.

  • React has an easier learning curve, so the ramp-up time is much shorter.

  • React offers a better mobile cross-platform framework solution than Angular.

  • React allows you to have a stronger opinion on how the code should be organized.

For this specific project, React was the best option to go. Its simplicity made it easier to learn, enjoyable to work with and it smoothed the transition to component-based architecture - for newcomers like me, this was an extremely valuable help. However, for complex and longer projects, Angular will fit better as it lets you have explicit types and detect errors in compile time.

Conclusion

Given so many frameworks to choose from, each one with its own peculiarities, deciding for the right framework can become a tough mission.
We felt that before when we decided to build the application in Vue.js first and now when considering Angular.

When we're between Angular or React, I think it mostly comes down to personal preference, as they solve the same problems but with different implementations.

However, in the decision-making process, it’s important to consider that React has an easier learning curve, which leads to quicker development, while Angular has more built-in functionalities.

Both technologies are very powerful, a clear improvement from the early days of web programming that enhances, facilitates and speeds up developing.

In this article, I talked about Angular vs React based on a web app I developed from scratch, using both frameworks.

FAQ

Q: Is Angular better than React?
A: It ultimately depends on the specific needs and requirements of your project. While Angular is preferred by some developers and may be better suited for certain types of projects, such as large-scale enterprise applications, React is also a powerful and widely-used library that offers a more flexible and customizable approach to development. Ultimately, the choice between Angular and React should be based on careful consideration of factors such as project scope, team expertise, and development goals.

Q: Why is Angular preferred over React?
A: Angular is preferred over React in certain cases because it provides a more opinionated and structured approach to development, with built-in tools for managing state, routing, and other common tasks. This can make it easier to maintain and scale large applications, especially in enterprise settings.

Q: Should I switch to Angular from React?
A: Whether or not to switch from React to Angular depends on the specific needs of your project and your personal preferences as a developer. It may be worth considering if you are working on a large-scale enterprise project or if you prefer a more opinionated approach to development.

Q: Is Angular easier than React?
A: Angular is generally considered to have a steeper learning curve than React due to its more complex syntax and built-in features. However, this may vary depending on the individual developer's prior experience and skillset.

At Imaginary Cloud we have experienced software developers in Angular and React. Need a boost in building your web application in one of these technologies? Get in touch!

Want to read more about React and Angular?

More than 500.000 people visit our blog every year and we are ranked at the top of Google for topics such as Angular and React. If you liked this blog post and would love to read all our blog posts on Angular and React,

Found this article useful? You might like these ones too!