Angular had two-way data binding while react has one way data directional flow from parent to child components.While two-way data binding works great for many applications, there are times when it can really start to slow things down. While full frameworks like AngularJS provide the model, view, and controller, React is a library that caters only to manipulating the view.
Angular should be used when….
Angular should be used if development time is less and you need a complete comprehensive framework that will get you running quickly for rapid prototyping and there are no heavy DOM manipulations.
Also react might have compatibility issues with legacy browsers like those older than IE8, so if you want to support even legacy browsers then earlier versions of angular might be a preferred option.
Angular 2.0 has a significant performance boost, including support for server-side rendering and a similar approach to using one-way data binding to only manipulate the parts of the DOM that need to be changed. However, Angular 2.0 also involved a major rewrite of the framework, so whether you choose to install React or upgrade to the next generation of Angular, there’s still going to be a learning curve to overcome.If you already know angular 1 or 1.5 then switching to version 2 might seem a little easier choice.
React should be used when…
When you need to manipulate or render large blocks of data-heavy content, like a photo gallery or lists containing hundreds of items similar to newsfeed in facebook , react might be a preferred option.For applications like these, you might want to take advantage of React’s virtual dom which keeps two copies of the dom viz the original one and an updated one that reflects changes fed in from the lifecycle methods of the view. The two versions are run through a React function that singles out the differences and outputs a stream of DOM operations that only alter the parts of the view that have been actually altered.This allows it to handle heavy dom manipulations.
Mobile App development
But frameworks like React Native and Nativescript are addressing this issue by accessing native components using a jswrapper which significantly increases the app performance. Reactnative is a framework that enables you to build components for native UI elements the same way you build them for HTML. React treats the view layer as a pure output of state, so switching its purpose from the web to mobile is as simple as swapping your tags with tags specific to the React Native framework. It also means your mobile app benefits from the same principles that make React so amazingly fast for web applications. JSNative apps will never be as fast as the native apps for a device, but for most tasks, React Native is more than capable of delivering a smooth user experience.
The option for angular developers in this field might be to use Nativescript with angular however there is still relatively less documentation and tutorials as compared to Reactnative.
The debugger is a crucial tool for web developers to fix errors,track performance and get logs of various event. AngularJS has ecosystem event-driven which makes the code is easy to write but hard to debug, as the complexity tends to increase and evolve over time. Angular does provide constructs that are easy to understand and, if used properly, can provide for a much more smooth debugging experience.React is a little different.You can get the official React Developer Tools extension for Chrome and do all your virtual DOM work without leaving your screen.
React’s code completion support, compile-time checks, and rich error messaging already create an excellent development experience that saves both typing and time.Also hot reloading saves a ton of time wasted in refreshing page to check changes done to the code.
Ways of implementation
Since angular is a framework more functionalities are available out of the box. With react there are multiple ways to achieve similar things like tons of boilerplates/starterkits with different set of functionalities and components,multiple libraries for routing,achieving unidirectional flow,API calls(ajax requests) and even to choose between Redux,Mobx or just Flux architecture based on complexity of the project.Developers need to make choices based on the scale of their of there projects.React apps were initially written using ES5 which are now shifting towards ES6 due to which the syntax of examples available on github and elsewhere differs a little.
Angular team has embraced Typescript in their examples due to which upcoming examples and projects are likely to have a consistent syntax.Hopefully react community will embrace Typescript more so that it becomes a standardized way for writing code.
Long term project management
Although React is slowly moving towards stability the ecosystem keeps on changing at a rapid rate since there are no fixed or set standards to achieve things in react mainly due to variations in routing and managing data flow using different flux implementations.Due to this the code or apps that you create today might get out of date or require major refactoring in the near future as the ecosystem changes.But well in the frontend world nothing particularly stays long in focus anyways.
Angular 2 on the other hand might not have such major changes since the team will make careful decisions and make sure that the project remains backward compatible as far as possible or until some framework like react does not comes to challenge them.
Angular is perfectly fine for a small or medium project since it is easy to rewrite if you need to, and tools like AngularJS (or Ember, for that matter) gives you a powerful toolset to kickstart your project and build it at incredible speed.
Now, the problem with big to huge codebases is very different. Big to huge project can span on many years, being worked on by many different people with many different skills, best practices and preferences.
I am not going to stress on framework size since as a developer we need to focus on functionalities and features of the framework and how it fits in the development of our next project rather than focusing on page load performance and site optimization right on the beginning.(React even with redux has lesser size than angular in case you are curious).Both the frameworks now support server-side rendering in case you need to optimize the site in order to improve your page rank.
If you want to explore uncharted territories, you can even use react as a view library with Angularjs by using react components within angular if you want (Check out ngReact project to get started).
In the end it will depend even on many other factors like your team size,prior experience,scale of the project,long-term code support and so on for making a decision to choose between frameworks.
(P.S. This article might be a little biased towards react since I mainly use react in my projects)
Feel free to mention your views about the frameworks and also mentions points that I might have missed if you would like to in the comments section.