React JS vs Angular 2

Introduction

I have been working with React JS and Angular 2 in the past few months and googled around to see which way to go. The best I did was to play around with react and angular 2 myself so I can taste the essence and make informed decision.

I have seen many commented about it is about comparing oranges and apples but as a developer, I would use either technology for one use, that is to build SPA application.

I have been to the path couple of times, once at myob and YVW and both times I could not just go past React.

I prefer React based on following observation

Make sense

React is simple and make sense to me when I build an application. There is no magic and it is pure JavaScript.

With ng2, you will need to learn component, templates, selectors and typescript to make a simple page.

Testability

React makes it so easy to unit test components. With redux idea or smart and dump components, it is lot easier, supply data, expect an output.

With enzyme, you can render the component and expect the result to pass the test.

Learning curve

React JS does not take your life to become familiar with it, it is so easy to learn and you know it already if you know JavaScript.

ng2, has blocker with typescript, and its own syntax to learn.

JavaScript

Like I said, it is pure JS and nothing else, javascript centric. You never have to write spaghetti html with JS injected. ng2 is html-centric.

Performance

Although, I did not personally experienced react is faster in rendering, there are various reports suggests react is much quicker in rendering compare to angular 2, thanks to his virtual dom rendering

Stability

React has been around for years now and angular 2 just released final version. It might be a while before all existing libraries start supporting. For example, I had trouble getting ADAL js to work with angular 2 out of the box.

Debugging

React is awesome, it tells you on screen when things goes wrong with line number. I always get lost with angular when comes to debugging.

During compile, you will know if the app will behave the way you want it :)

Size

React is much smaller. period.

React-native

Well, you simple develop react native to deploy native apps, you just learnt react.

Libraries

You are free to use any libraries with React, for example for remote calls, use axios or bluebird and keep up to date with it too.

Server rendering

With universal, you can render application state from server and produce html for the client. Much quicker for user to see data without having to issue request to server from client.

Data flow

Uni-directional with pub sub modal.

Reusable component

Components are reusable.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.