First of all, React is a library and Angular is a framework. Developers these days have a complicated relationship with Angular. It is not wrong to say that they are getting stuck in the middle of a simple app for weeks. Even for simple features, you need to struggle a lot so, it's difficult to say that is it worth using Angular.
Although you have thoroughly grasped the basic fundamentals which should be enough to code small features. Unfortunately, it didn't work out. That's why finally developers gave up Angular and adopted React as an alternative. The react learning curve is smaller and blending libraries is also easier.
There are multiple reasons behind migrating from Angular to React. Most of the developers are moving to React being closer to Javascript and to take full-fledged advantage of modularity. Let's have a look at some more reasons to convince why moving to react can be a good choice.
React is an Innovative Space
React have building blocks that provide flexibility to pick a suitable block to fix your problem. It allows exchanging building blocks for experimentation and adoption, which makes it innovative.
State management is done through MobX and Redux and enables exchangeability with Preact and Inferno.
While this approach is not possible with Angular, as it delivers its own solutions.
JSX Syntax Blends with Javascript
React has its own syntax for building components called JSX. JSX is a blend of JavaScript and HTML. JavaScript can be implemented to manipulate and compose DOMs and to create in-built functionalities such as filters and maps. Thus the full potential JavaScript can be integrated into HTML code to speed up development by 4 times.
On another side, Angular doesn't allow us to mix view and logic.
React has a Simple API
Components in React comes in lifecycle methods. There are 9 methods but you only need a couple of them to control components of a mature React application.
There is an ES6 class component method SetState() which can update the internal components state.
There are concepts like state and props regarding which you can explore in the official documentation of React. One can easily use the view library to solve problems.
Lightweight Components
React has two different types of components -
ES6 components and functional stateless components.
The functional stateless components are functions without a boilerplate. It means you use them while accessing lifecycle methods or component state.
Thus it makes the components lightweight, small, and reusable.
Functional Programming
Functional programming means it's having a declarative programming style in which everything is in mathematical function style. Programming in React is similar to JavaScript.
In React functions are build with no side-effects which makes it so predictable - it always returns the same output and easily composable as higher-order functions are implemented for composition. Among the JavaScript library, React is known as the leader of functional programming.
Top comments (4)
Angular to React? Hell No.
And why so?
Angular shines great for enterprise applications. Try building enterprise apps in react, things get dirty and messy when project complexity grows. Also angular encourages best practises out of the box, react doesn't. You'll likely write ugly/messy code if not skilled enough.
Nope