Front-end framework elections 2021
We often get the question: "What front-end framework do you advice?". There is obviously not an easy answer to this question. It all comes down to what fits your team best, but there are some criteria that are generally applicable and can help you decide.
Criteria we use are:
- Available experience in your team
- App possibilities
- Static site generation possibilities
The front-end frameworks that we evaluate in this assessment are Angular, React, Svelte and Vue.
Community support and the tool eco-system around it are extremely important.
We express community support in the number of developers, available libraries, (official) documentation and blog posts. With respect to the number of developers, the State of JS 2020 survey results gives a good overview: React, Svelte and Vue are the leaders. Angular is only about half as popular as these three. Angular's shrinking popularity (and React and Vue growing popularity) is confirmed by the Github stars trend.
Looking at Stackoverflow activity these are results:
- Angular: 235,430 results
- React: 465,982 results
- Svelte: 2,869 results
- Vue: 87,342 results
React is by far the most actively discussed topic, followed by Angular and Vue, and Svelte is really a niche.
There are no real differences in what you can functionally achieve with Angular, React, Svelte or Vue. They all enable you to create HTML presentation components and handle state in your application.
The difference lays in the way you implement a certain feature. Main differences between between the frameworks are:
|Data binding||2-way binding||1-way binding||2-way binding||2-way binding|
Besides this description, there are other good references that discuss the differences, for example here.
Angular uses a framework and therefore offers a lot of functionality out-of-the-box, it strictly prescribes the way-of-working and tooling to use.
React, Svelte and Vue apply a library based approach, where they focus on core functionality: presentation, state handling and routing. Functionality outside of the core needs to be added using external libraries and with respect to way-of-working and tooling there is more freedom.
Data-binding comes in 2 flavors: one-way and two-way binding. With one-way binding data only flows (automatically) down in the component hierarchy. Two-way data binding enables an automatic up- and down- data flow.
React support one-way data binding, while the others support two-way data binding. In case of React you will need to explicitly write the second binding. The advantage of two-way binding is less boilerplate, the disadvantage is that code is potentially more difficult to understand.
Examples of data-binding per framework can be found here:
Angular requires you to use Typescript, this gives the advantage that Typescript is well supported out-of-the-box. The other frameworks apply an opt-in strategy: Typescript can be added when desired.
It is important to recognize the value of readily available experience within your team. When you have a team where all members have been working with e.g. Angular for the last few years, it most likely not worth migrating to another framework. The decision gets more interesting when part of your team has limited Angular experience and the other part has limited Vue experience. For a team without prior experience you can simply skip this consideration!
We often hear the wish to create a Progressive Web Application (PWA), and at the same time the wish to having to possibility of creating a native (iOS, Android) app from the same code-base in the future. The first part is simple: all frameworks discussed here provide decent PWA support. Creating a native app from the same code-base is more challenging.
- React native
We do not consider Electron as viable option for creating an app from your website as it requires you to create a completely new codebase.
React native offers the possibility to, by adding a few React native components, build a native React based app.
Capacitor offers the possibility to translate Angular, React or Vue based application code into a native app. Vue has one more option: Vue Native, but this is currently in its early days.
State-of-JS 2020: Electron and React Native are the two best-known names in this category
Static site generation possibilities
We want to build the best performing websites. For public facing websites that means generating a static website and deploying it on a CDN. This is not a deep dive into Static Site Generation (SSG) options, but not having the possibility to do SSG is blocker for us.
A short overview of the possibilities per framework:
You can find a complete SSG overview here.
React and Vue offer the best (and most) SSG options, while Angular and Svelte have a very limited set of possibilities that tend to be less popular.
Looking at community, React and Vue are the clear winners, Svelte is still a (upcoming) niche player, and Angular is loosing in terms of popularity.
With respect to features there is no big differences between the frameworks: your developer's experience and preference might lead to a preference here.
When you want to develop a native app from the same code-base React is your safest choice.
Static site generation is a requirement for modern public facing websites, we believe that currently only React and Vue have good SSG libraries available.
What did we choose at Unplatform?
For us it was actually quite easy, we have team of experience React developers and the community and app possibilities are best with React. So our choice is React, but we evaluate our choice every year. See you next year!