David Hockley

React vs Angular: Which One is Best?

Angular or React.js: Which one is it best to learn? Which is the best to use for a project? And most importantly, what are the structural and fundamental differences between these two solutions?

Two logos tell a visual story

I've been working with Angular since 2016 and with React since 2019 (And by Angular, I mean Angular 2 and later, not AngularJs). And to me, although the two serve a similar purpose, they feel radically different to code with. \ The first point to underline is that Angular is used on Gmail and Google products in general, at Microsoft Office Online, at UpWork, at Sony, at Forbes. Whereas React is used at Facebook, Instagram, Netflix, Dropbox, and Uber. So both Angular and React are mature solutions with strong references. However, those names tell a story of two very different worlds and provide a first clue about the underlying difference between the two solutions.

A difference in philosophy embodied visually

The logos tell a similar story. Angular's logo is a shield, a symbol of solidity and security. On the other hand, React's logo is an atom. If you combine the semantics of React and an atom, you get an explosion, an atomic reaction. The polar opposite of safety.

The internal mission statements of these two companies show the same opposition. Google, where Angular was created, aims to "Do no evil". Facebook, the birthplace of React, wants to "Move fast and break things". Where Google sounds very law-abiding, Facebook's internal motto gives off a rebellious bad-boy vibe. Their two solutions (Angular and React) embody these two mindsets. And the companies that use these two solutions reflect this state of mind: solid and sensible companies are touted on the Angular side, whereas the React champions are disruptive. If you were to translate this to roleplaying terms, Angular would have a Lawful Good alignment and React a Chaotic Neutral one.

What structure?

In terms of internal structure, the same opposition applies: there is no pre-imposed structure on the React side. In Angular, there is a coding and naming convention derived from the MVC (model view controller) model. The filesystem structure reflects this, each module has a folder, in the module folders, we have folders for each component. And all this must be followed for the application to compile.

React doesn't have an MVC structure, just functions that render code directly (at least if we are using functional components). *How to *structure the code and the filesystem is left firmly for the developer to decide.

The practical impact

How are Angular and React different in practice? In my experience, the differences in structure lead to bigger components with larger scope in Angular, whereas React is conducive to more focused components. Reusing components is also more complex in Angular, whereas doing so in React requires minimal effort.

Because Angular is a fully-fledged framework with a larger scope (it provides more functionality out of the box, like routing or internationalization or two-way state management) and a pre-defined structure, it has a steeper learning curve.

React on the other hand is a focused library, with less structure and less scope, making it easier to learn because there is less of it to learn, at least initially. You can cover the main concepts in an afternoon. That single-minded focus is also what gives it greater flexibility.

Angular provides security and structure where React provides agility and speed.

Which one do I recommend?

First, I would recommend learning JavaScript and TypeScript before learning either. Once that is done, if you can, learn both. If you can't, my recommendation would depend on your personality traits, on how risk-averse you are, and on how much structure you need.

If you need things to be standardised and secure, I would advise Angular. If you need action and flexibility, I would recommend React. If you want a development career in the banking sector or a stable work environment, favour Angular.

If you prefer to work in a start-up where everything is moving in all directions, I recommend React.

Both are good choices, but only you can answer which one best fits where you want to go.

Social
Made by kodaps · All rights reserved.
© 2023