36
Comparing Angular, React, Vue, and Vanilla-JS
Let's take an analytical look at several of the key library / frameworks and compare them to Vanilla JavaScript.
Basically, I want to explore these tools in various ways:
To do this, four separate builds of the same project were implemented. There were three "frameworks":
And, the fourth build was Vanilla JS.
The core logic was complex enough to use several parts of the frameworks, but simple enough I could build this in a reasonable time frame.
There is a lot of data here and the first question I generally get as people look at the content is, "which library should I be using?"
My basic assessment is whichever fits your needs the best.
This is extremely vague; let's dig in a bit further.
From a general speed standpoint, all the library are about the same, so we need a different set of parameters to choose the best library.
These conclusions are my own opinion ...
Angular is geared to Test Driven Development and is well suited for Enterprise level development. Their documentation is excellent and the community is responsive.
React has suitable testing tools. Their documentation just got a major upgrade and their community can be best described as "fierce."
Vue has good test tools and reasonable documentation. The community is small but this can work as an advantage since changes don't come out as frequently as Angular or React; requiring less general updating of the code.
Vanilla JavaScript is here for a reason. While it is not a library, with many of the more recent changes it has become a solid tool for development.
Recently, I worked with a client that had a CMS in-place and they had missed several upgrades to the core software. Upgrading was going to be an in-place replacement and very painful. I migrated them to a Vanilla JavaScript solution which keeps the software behind their site good for a long time.
Having given this example, Vanilla JavaScript is not a good solution for larger endeavors (although, I've seen some interesting implementations).
This article basically shows that many of the popular libraries are now more comparable than ever which allows organizations to truly select which pattern(s) work best for them.
tl;dr
Category | Angular | React | Vue | Vanilla-JavaScript |
---|---|---|---|---|
Code (assets 4.2M) | 19k | 28k | 21k | 232k |
Build (assets 4.2M) | 273k + assets | 760k + assets | 1.3M + assets | --- |
Development Time | 8 Hours | 8 Hours | 8 Hours | 3 Hours |
Version | 12.2.0 | 17.0.2 | 3.0.0 | --- |
Category | Angular | React | Vue | Vanilla-JavaScript |
---|---|---|---|---|
Transferred | 25.7k | 19.9k | 16.5k | 4.3M |
Resources | 7M | 6.2M | 7.7M | 4.3M |
Load Time | 705-740ms | 750-826ms | 640-654ms | 859-872ms |
DOM Loaded | 411-441ms | 293-327ms | 403-424ms | 255-260ms |
Category | Angular | React | Vue | Vanilla-JavaScript |
---|---|---|---|---|
Setup Process | ng new <project-name> |
npx create-react-app <project-name> |
vue create <project-name> |
Manual |
=> Routing | Angular Router | React Router | Vue Router | Folder / File Structure |
=> Binding Props | [attribute] | attribute={} | :attribute="" | Manual |
=> Binding Events | (click)="" | onClick={} | v-on:click=fn() | Manual (jQuery) |
=> Services | baked-in | import class | import class | import class |
=> Referencing Assets | http-get, import | http-get, import | http-get, import | Manual |
Unit Testing | baked-in (ng generate [type] [location] ) |
simple example | Manual | Manual |
VERSION: 12.2.0
Installation is via the Angular CLI (ng) ...
npm install -g @angular/cli
The CLI can be updated via
ng update
...ng update @angular/cli @angular/core
A new project is started with
ng new <project-name>
. There are various options provided (routing and/or CSS).ng new <project-name>
ng serve --open
ng test
ng build
Built-in Unit Testing, as well as E2E testing. The CLI includes these as
ng generate <type> <location/name>
is used.Build and Size:
Performance: 71
Best Practices: 93
VERSION: 17.0.2
There is no real installation since the setup is via NPM/NPX.
Installation is via npx (installed with NPM) ...
npx create-react-app <project-name>
npx create-react-app <project-name>
*
npm start
npm run build
npm test
*
npx
-- runs a command from a local or remote npm package (SEE HERE).Jest is included in the base-build with one simple test.
This configuration allows for a VERY clean Unit Test and E2E Testing environment.
Build and Size
Performance: 79
Best Practices: 100
VERSION: 4.5.13
Installation is via the Vue CLI (vue) ...
npm install -g @vue/cli @vue/cli-service-global
The CLI can be updated via
npm update
...npm update @vue/cli @vue/cli-service-global
A new project is started with
vue create <project-name>
.vue create <project-name>
npm run serve --open
npm run test
npm run build
No tests provided for the base installation.
Build and Size
Performance: 46
Best Practices: 87
VERSION: none
none
Manual creation of all files and structure.
Manual.
No tests.
Build and Size
Performance: 95
Best Practices: 93
Category | Angular | React | Vue | Vanilla-JavaScript |
---|---|---|---|---|
Code (assets 4.2M) | 19k | 28k | 21k | 232k |
Build (assets 4.2M) | 273k + assets | 760k + assets | 1.3M + assets | --- |
Development Time | 8 Hours | 8 Hours | 8 Hours | 3 Hours |
Version | 12.2.0 | 17.0.2 | 3.0.0 | --- |
Category | Angular | React | Vue | Vanilla-JavaScript |
---|---|---|---|---|
Transferred | 25.7k | 19.9k | 16.5k | 4.3M |
Resources | 7M | 6.2M | 7.7M | 4.3M |
Load Time | 705-740ms | 750-826ms | 640-654ms | 859-872ms |
DOM Loaded | 411-441ms | 293-327ms | 403-424ms | 255-260ms |
Category | Angular | React | Vue | Vanilla-JavaScript |
---|---|---|---|---|
Setup Process | ng new <project-name> |
npx create-react-app <project-name> |
vue create <project-name> |
Manual |
=> Routing | Angular Router | React Router | Vue Router | Folder / File Structure |
=> Binding Props | [attribute] | attribute={} | :attribute="" | Manual |
=> Binding Events | (click)="" | onClick={} | v-on:click=fn() | Manual (jQuery) |
=> Services | baked-in | import class | import class | import class |
=> Referencing Assets | http-get, import | http-get, import | http-get, import | Manual |
Unit Testing | baked-in (ng generate [type] [location] ) |
simple example | Manual | Manual |
Basically, it all boiled down to the simple fact that there's very little difference in complexity, functionality, and testability between each of these approaches.
There's no significant difference in selecting one package over another when it comes to the factors examined in this article.
There is a lot of data here and the first question I generally get as people look at the content is, "which library should I be using?"
My basic assessment is whichever fits your needs the best.
This is extremely vague; let's dig in a bit further.
From a general speed standpoint, all the library are about the same, so we need a different set of parameters to choose the best library.
These conclusions are my own opinion ...
Angular is geared to Test Driven Development and is well suited for Enterprise level development. Their documentation is excellent and the community is responsive.
React has suitable testing tools. Their documentation just got a major upgrade and their community can be best described as "fierce."
Vue has good test tools and reasonable documentation. The community is small but this can work as an advantage since changes don't come out as frequently as Angular or React; requiring less general updating of the code.
Vanilla JavaScript is here for a reason. While it is not a library, with many of the more recent changes it has become a solid tool for development.
Recently, I worked with a client that had a CMS in-place and they had missed several upgrades to the core software. Upgrading was going to be an in-place replacement and very painful. I migrated them to a Vanilla JavaScript solution which keeps the software behind their site good for a long time.
Having given this example, Vanilla JavaScript is not a good solution for larger endeavors (although, I've seen some interesting implementations).
This article basically shows that many of the popular libraries are now more comparable than ever which allows organizations to truly select which pattern(s) work best for them.
36