Celebrations: Happy Thanksgiving to all our American readers!
Interview with Dr. Marius Hofmeister and Stephan Rauh

Angular vs. React – Who’s one step ahead?

Dominik Mohilo
Angular

© Shutterstock / RomanYa

Deciding which JavaScript framework is best for your web application is never easy especially if you have to choose between Angular and React. We talked with Dr. Marius Hofmeister and Stephan Rauh about the advantages of Angular and React compared to other frameworks and when to use them.

JAXenter: Hello Stephan, Marius. Thank you for taking the time to do this interview. In the —big— world of JavaScript frameworks, Angular and React have been vastly adopted by frontend developers. What are the advantages of those two compared to other frameworks like Ember.js, Vue.js, Polymer etc.?

Marius Hofmeister & Stephan Rauh: Both these frameworks have their advantages and a huge fan base. We concentrate on Angular and React because our customers request them in most cases. In our humble opinion, Angular.js and React.js have vehemently stirred up the market and displaced many of the well-established frameworks. In addition to the technical aspects, we like Angular and React because they both have a big, active and helpful community. Plus they get developed and pushed forward by big companies, which means investing in them is kind of safe.

The three other frameworks you mentioned have a lot in common. The main element in Polymer is represented by components, which is also the case for React and the more recent versions of Angular. As of yet, we haven’t had the chance to work with Ember.js but considering the blog posts that I (Stephan) read, it seems to be a framework that is not much different from Angular, but with a much bigger emphasis on user guidance. Therefore, Ember.js behaves, in relation to Angular, like Angular behaves in relation to React: it offers faster development at the sacrifice of flexibility and gives developers strict guidelines.

Vue.js is an exciting new framework that was designed as a lightweight essence of Angular.js. Like with Ember.js, we didn’t have the chance to actually work with Vue.js, so we again depend on the information from third parties. A former colleague of mine (Stephan) said that Vue.js is exactly like Angular, with the difference that this time everything was done right. But whether it stands a chance in the market or not is a whole different discussion. One thing is certain though: It will definitely give new impulses to both Angular and React.

SEE ALSO: Angular, Ember and Vue: Is choosing a framework simply a matter of taste?

And that is the real exciting aspect of this rich and vast landscape. The creators and committers of each big and established framework are keeping track of the competitors’ new and interesting development. Ideas that prove their worth and fit in with one’s own philosophy are often adopted. This way, everyone gets better together. 

JAXenter: Your session at the International JavaScript Conference was suitably named “Angular 5 versus React”. What are the main differences between those tools?

Marius Hofmeister & Stephan Rauh: Philosophy-wise, Angular is a full-stack framework that has solutions for almost each and every aspect of frontend development. React, on the other hand, is used mainly for building components and displaying them properly and efficiently. Routing, validation, communication with the backend and so on are tasks that React ignores on purpose. 

In Angular, you pay for safety by sacrificing flexibility.

But that is just theoretically speaking. In practice, it is a whole other thing. Every developer that uses React has his own collection of libraries for the above-mentioned tasks. Eventually, they end up having a framework that is as fully equipped as Angular. The only difference is the search for the right libraries at the very beginning and the danger of having a non-functional library after updating React. With Angular, you get some sort of carefree package, since the Angular team is handling such things. Or, in other words: In Angular, you pay for safety by sacrificing flexibility.

JAXenter: There are probably many use cases in which one of the frameworks works better than the other. Are there use cases where neither Angular nor React are suitable?

Marius Hofmeister & Stephan Rauh: Essentially, you can use both frameworks for everything: Angular has its advantages for implementing classic applications in office environments, as long as the amount of data is not too high and the possibilities for interaction are somewhat restricted.

If an application includes many dialog elements that interact with a whole lot of other elements, and performance is still a key factor, React is more suitable. That is also valid, even though Angular is much better at this than Angular.js was. We have the feeling that React is especially popular when developing interactive websites. One of the reasons for that might be the smaller size of the resulting React.js application.

If your goal is a good (or as good as possible) support of mobile devices and even desktop PCs, we recommend not using either Angular or React. Anything is possible, of course, but when it comes to ideal support, nothing beats native development. A common requirement is the seamless integration of Excel inside a business application. Even with HTML 5, this always means compromising.

SEE ALSO: Preact: The fast 3kB open source alternative to React

JAXenter: Are there any newcomer projects that you advise users to keep an eye on?

Marius Hofmeister & Stephan Rauh: Vue.js is a good example of a promising and exciting project. At this point, it seems like it has an even bigger impact than Aurelia. The 70.000+ stars on GitHub show exactly how interested the community is in Vue.js – even though newcomer projects have had a hard time having such an impact on the scene recently.

Building a good framework is not enough these days, and it is not even enough to build a better one than your competitors’. Nowadays, the toolchain and the ecosystem are much more important than the framework itself. An example for that is that most modern IDEs support Angular and React natively. The Angular CLI is giving you a head start at the very beginning of your project, while the Redux DevTools have a time traveling debugger, which is a killer argument for React in itself. A new framework has to keep up with all of that.

Angular and React are solving the same problems with different approaches. 

JAXenter: What was the key takeaway of your talk at the International JavaScript Conference?

Marius Hofmeister & Stephan Rauh: In our session, we showed the technical aspects are not the only ones that matter when it comes to deciding between Angular and React. Sure, they sometimes matter and we tried to show the audience some objective criteria regarding this topic. When I (Stephan) published them on my blog (BeyondJava.net) I received mixed reactions, ranging from “complete bullcrap” to “you are so right”.

Angular and React are solving the same problems with different approaches. One thing you should really take into consideration is your team: Does it have years of experience in JavaScript? Then React is probably the best choice.

Teams with a strong Java background usually feel more comfortable using Angular. TypeScript is one of the reasons for that, as it has many of the structural characteristics that Java developers are missing with JavaScript. JavaScript experts are sometimes put off by that because their freedom is quenched by TypeScript’s strong type system.

Well, theoretically, the type system only quenches the freedom to make mistakes, but in practice, there really are problems when using existing JavaScript libraries with TypeScript. Projects like Definitely Typed come in handy but are far from perfect. This is probably another reason why Aurelia and Vue.js are so popular: the major forces behind those projects did not want to cope with every decision the Angular team made. Deciding for TypeScript and against JavaScript is one of those.

There are also many discussions about the MVVM paradigm, as it includes many structures that Angular developers like to use. React managed to overcome paradigms like MCV and MVVM. Focusing on components comes with establishing structures, just different ones. This also shows that deciding between Angular and React is, in many cases, dependent on the preferences of the team.

Thank you!

Author
Dominik Mohilo
Dominik Mohilo studied German and sociology at the Frankfurt University, and works at S&S Media since 2015.

Comments
comments powered by Disqus