Tuesday, July 27, 2021

Difference between Angular and React

React is a library for building User Interface, while Angular is a framework to build the entire solution project.

As a library, React only handles user interface interaction. It does not handle network requests, url routing, and resource loading. 

On the contrary, Angular is a js framework. As a framework, it includes all the features to create an application, including UI interaction, UI component, http request, routing, and authentication, etc. Framework requires the project's structure to follow its predefined way to to handle different things.

The advantage of using a framework is, it already has the solution for many common features required by regular project, and those solution are verified by many other projects, so following the direction of a framework will not have too much risk during the development, the framework already decides many aspects of the project, and developers do not need to come up with a solution by themselves for each requirement, so the project's quality is already guaranteed by the framework. 

However, framework is hard to customize or extend, so if the project has some unique feature that is not covered by the framework's solution, then it is hard for developers to customize or extend the framework to handle the unique requirement. 

In addition, for some simple and small project, it may not need the full features of a framework, in this case, using react as a library is also a good choice for quick starting.

For the same reason, react is easier to learn due to its limited scope, while angular has a deep learning curve due to its large feature set and complex. 

From a developer's view and experience, overall, react is a better choice due to its simple logic and syntax. Angular has many unnecessary steps developer need to do, for example, you have to register packages in module.ts in addition to the simple js import, etc.