Angular and React have emerged as giants in the javascript framework world. So whats the difference between them, and when should you use them?
Quick facts
What | Angular | React |
---|---|---|
Developer | ||
Initial Release | 2009 | 2013 |
Model | ✓ | third party libraries eg flux/redux |
View | ✓ | ✓ |
Controller | ✓ | ✘ |
Component based | ✘ | ✓ |
Learning curve | Hard | Easy |
Ecosystem | 6,169 NPM packages 109,793 Github search results |
11,069 NPM packages 58,605 Github search results |
Extensibility | Filters Constants Modules |
✘ |
Mobile | Ionic - mature cordova cross-platform wrapper | Reapp - not yet mature React Native - using native controls for performance |
When should you use them
Angular
Angular introduces more concepts and abstractions than React, so is more suited to larger applications with teams of experienced developers. The concept of a 'filter' exists in Angular to convert data from one format to another (eg from '1457819216543' to '12th Mar 2016') meaning when it comes to more complex conversions, such as when mapping data to a graph, the template developer already knows how to apply the filter. By comparison in React there would have to be an external library included in and run in the component itself.
React
With a much gentler learning curve, React is well suited to smaller teams with less experience, or looking to produce a prototype quickly. There are fewer structures built in to react (for example there is no custom event system ie 'onLogin') so there needs to be much greater cross-discipline communication between the javascript and template engineers. On the other hand, when a team works closely together on an application it can be produced remarkably quickly, with react forcing isolation of components much more than Angular, meaning reusing a component in another part of the site is much easier.
TL;DR
Use angular if you have a complex app.
Use React if you have a simple app, or need a prototype.