DEV Community

Cover image for React vs Angular vs Vue.js — Which one should you choose?
Eduard Tar for Adroit Group Kft

Posted on

React vs Angular vs Vue.js — Which one should you choose?

Image description

At the beginning of a new project, front-end developers must answer the following question: Which framework should I choose? What is the best framework for my needs? In this article, we will give you a brief overview of the most popular front-end frameworks and how to choose the one that best suits your needs. These frameworks are Angular, React, and Vue.js.

Angular vs React vs Vue

With Angular, you can quickly create a front-end application with lots of tools, components, and services. According to Angular’s website, Angular defines itself as:

“The modern web developer’s platform”

Google develops and maintains it but is not used by any of its most popular products, like Search or YouTube. Angular can be used to create single-page applications (SPAs), websites, hybrid applications, and mobile applications.

Angular has been around for quite a few years, so it has been thoroughly tested, and you can use it on large-scale projects. Angular has a rich ecosystem with many tools that you can use to speed up your development process.

Angular consists of a template, a class that defines the application logic, and metadata (decorators) in addition to a component’s template, metadata, and class. Angular uses the metadata to locate the components’ building blocks. Angular template syntax is available in HTML, as well as reactive data and multiple-element rendering.

Services in Angular are used to delegate data-fetching and input-validation duties to components in addition to other things. The Angular framework isn’t enforced, but it’s highly suggested to structure apps as separate services, which are a distinct part of Angular applications.

To get the most seamless experience, TypeScript is encouraged, but plain JavaScript is also supported.

React is considered a UI library. They define themselves as:
_
“A JavaScript library for building user interfaces”_

It was created by Facebook and is a front-end library that has become very popular recently. Because React doesn’t enforce a certain project structure, it can be used as a UI library to generate elements, and it’s not technically a framework. React apps are made up of React Elements, the smallest units.

The React DOM ensures that they are efficiently updated whenever a change occurs. They are more powerful than standard DOM elements because they are updated more efficiently. Components are larger building blocks that you may use throughout the application.

Props are inputs that are provided to elements which are then displayed to the user. You may create elements that combine HTML, JavaScript, and JavaScript XML with the React JavaScript API. Many developers prefer JSX as it is more understandable.

Lastly, Vue.js is, according to its site:

“A progressive JavaScript framework”

It was created by a Chinese engineer Evan You who has also worked on Angular. Vue is relatively new, and it is growing rapidly in popularity. The Vue.js core library focuses on the View layer only. It’s called a progressive framework because you can extend its functionality with official and third-party packages, such as Vue Router or Vuex, to turn it into an actual framework.

Although Vue is not strictly associated with the MVVM (Model-View-ViewModel) pattern, its design was partly inspired by it. With Vue, you’ll be working mostly on the ViewModel layer, to make sure that the application data is processed in a way that allows the framework to render an up-to-date View.

Vue’s templating syntax lets you create View components, and it combines familiar HTML with special directives and features. This templating syntax is preferred, even though raw JavaScript and JSX are also supported.

Components in Vue are small, self-contained, and can be reused throughout the application. Single File Components (SFCs) with the .vue extension contain HTML, CSS, and JavaScript so that all relevant code resides in one file.

SFCs are the recommended way to organize code in Vue.js projects, especially larger ones. Tools such as Webpack or Browserify are required to transpile SFCs into working JavaScript code.

In Vue.js projects, SFCs are the preferred method for organizing code. To turn SFCs into functioning JavaScript code, you must use Webpack or Browserify, among other tools.

These three frameworks have a variety of similarities, including a component-based architecture and ease of UI feature production. React and Vue.js are primarily declarative, and although Angular is also declarative, it is really more imperative. Despite some more distinctions in structure, architecture, and operation, let’s take a look at them all.

Ecosystem

Using open-source packages can save you a lot of time when developing applications. In addition to being battle-tested, they tend to have better functionality than custom-made packages and components.

Angular:
There are many ready-to-use components that can be imported from other projects, but Angular also offers a wide variety of official components in the Angular Material project offering Material Design components for Angular applications.

Cross-platform mobile applications can be created in Angular using NativeScript, which, though offering Vue support, has more comprehensive Angular support.

Angular is also part of the MEAN stack that combines Angular with MongoDB, ExpressJS, and NodeJS. Like the MERN stack, it uses JavaScript for both front-end and back-end development.

React

:
Many front-end applications use global state management to store information such as who is logged in and other user settings.

Redux is the most popular JavaScript state management project, and most developers use the official React bindings for Redux, which are maintained by the Redux team.

React is extremely popular, so finding input components and ready-to-use elements is very easy. They are all just a Google or GitHub search away.

The React ecosystem also includes React Native, which allows you to build native iOS and Android applications from a single codebase written in React. Therefore, React can be a great choice for building mobile applications using web technologies.

React is part of the MERN stack with MongoDB, ExpressJS, and NodeJS. The great thing about this combination is that a single language — JavaScript — powers the whole application.

Vue

:
Even though Redux can be used in Vue, there are no official bindings. However, this should not concern you because Vuex is the official state management library created specifically for Vue applications. In addition to integrating very well with Vue, it is easy to debug using Vue’s developer tools.

In the early days of Vue, it was harder to find ready-to-use components. However, since the community has grown, there is now a wide range of input components and advanced elements available to use, which can speed up your development.

For mobile app development, there is an up-and-coming project called Weex. Weex is being developed and used by Alibaba, but it is not as mature or powerful as React Native. Additionally, since the project is developed and used more in China, it can be harder to find documentation and solutions to issues in English.

Vue integrates well with Laravel, and that is why they are often used together. Laravel offers complete JavaScript and CSS scaffolding to enable the use of Vue in new projects.

Common Technologies

Angular, React, and Vue can be used to create PWAs (Progressive Web Apps).

PWAs are not mobile apps but web apps that smartphone users can add as shortcuts to their home screens. They have a similar look and feel to native mobile apps.

Each framework has access to premium templates and pre-made applications, though Angular and React have more premium options than Vue.

Performance

When choosing a framework or library, you need to think about performance as well.

In many cases, you won’t have to worry about performance, especially if you’re building a small project. However, the more a project grows in scope and complexity, performance can (and will) become a concern.

It’s important to note that the quality of development and following best practices when it comes to web performance are more important than the choice of framework.

But since there are some performance metrics and differences, I’ll look into them and explain how each could affect your development efforts.

*JS Framework Benchmark:
*

According to the results of the JS Framework Benchmark, Vue.js is generally the fastest framework. Despite this, there isn’t much of a difference.

There are three relevant actions here: selecting a row where React is a bit slower than the others; swapping rows where both Angular and React are much slower than Vue.js; and clearing rows where Angular is slowest.

Image description

Perf Track:

Hundreds of thousands of websites are measured by Perf Track, but here we will focus on just a few of them (you can view the full results here: Angular, React, Vue.js).

Image description

Both React and Vue.js are noticeably faster than Angular when loading and presenting the first content (FCP) and the largest one (LCP).

In terms of Cumulative Layout Shift (CLS), React has the most sites with a CSL below 0.1. Nevertheless, the results for Angular and Vue.js are worse, but not significantly.

Regarding the time taken from a user’s first interaction with a site (FID), all frameworks bring good results.

Finally, the time between the browser requests a page and the first byte of information from the server it is received (TTFB) is lower in Angular than in React and Vue.js, with React being the slowest framework.

Conclusion

There are many factors to take into consideration when picking a front-end framework. The popularity of a certain framework is one of the key indicators, but not the only one.

If you have vast quantities of dynamic data to display, Vue.js should be taken into strong consideration. If you aspire to create a rich user interface, React is a good choice. If you need to build a complex application, Angular would be your best bet. With that being said, it is important to choose the right tool for the given job.

By taking into account the factors we have discussed in this article, you should be able to hand-pick the best framework for your needs.

Originally published at adroitgroup.io and written by Balázs Szabó

Top comments (0)