The best way to learn React is.. to learn Angular?!

Michael Di Prisco - Nov 24 '20 - - Dev Community

Intro - I'm an Angular developer and the title is not click-bait.

I've been working with Angular (From V4 to V9) for at least 1.5 years now and I've been enjoying every bit of it.

In this post I'll try to explain my reasons behind moving from Angular to React, and why I'll probably come back, in certain cases.

From routing to dependency injection, from TypeScript support to services, I worked in both big and small projects and always felt empowered by the awesome toolkit provided by Angular.

I had also a chance to look at state management via NgRx and NgXs and enjoyed them also.

I feel like I'm not an Angular expert, but I can surely bring a nice project from idea to deployment with confidence.

Choosing React.

One day a call arrived and I decided to move.
I'll start a new job at a new office in January and had a chance to choose my front-end stack as I'll be responsible for creating and training a new team for some new big projects to be developed during the next year, and felt like I could give another framework a try as I saw 99% of what I could see in Angular and wanted to learn something different.

I had a look at Vue, as I've been working a little with it in 2018, but felt like, if I had to move, better do it for the most popular one, so I went for React.

P.S. I didn't decide to try React because it was simply the most popular, but because being such allows me to have a wider developer audience to get information and tools from. It's the first time for me as a team leader, so I felt having a little more help from the community could only help.

The problem.

When I started studying Angular, coming from a vanilla JS - Vue.js background, I clearly felt overwhelmed by the steep learning curve everyone mentions when talking about this framework, and I needed ~3 months of studying in my free time to grab the fundamentals and start doing something good (P.S. Thank you Mosh Hamedani for your incredible course).

As someone who never looked at a single React snippet, I thought it could be equally hard to grasp and master this framework and started to feel a little doubtful about my decision.

But, nonetheless, I decided I could give it a try.

First steps with React

As soon as I started my new course on React (Thank you Mosh, again!) I realized the length was different (We are talking about ~75% length reduction in the course) and thought

Well, I guess I could give it a try, see what it's all about, and then decide if I want to move to React or stick with Angular

I started as everyone else did, I guess.

Reactivity in React, a simple counter, child components, props, prop drilling, class vs function component, state management, hooks, and.. stop.

Yes, you read that right, STOP! That's React.
Of course, I know React has thousands of features coming from official and unofficial libraries, routing systems, global state managers, GraphQL clients, etc., but nonetheless React is just that, and if you want to start with some simple stuff, that's all it takes.

So, Michael, how much time did it take for you to learn this stuff?

As I was running like Flash through the course, I realized one thing: Every framework shares a fair 50-60% of fundamentals with every other, so if you grasp them in Angular, you can reuse the same mental model for React. So what's my answer? 3 hours.

Yes, I'm not joking, I just needed 3 hours to learn it. And wanna know the most incredible thing?

I took the best from Angular and brought it with me into React with no hassle.

I don't wanna bother you with code snippets and long discussions about which one is better. Angular and React solve different problems in different ways. But, to provide an understandable example, everyone who has ever worked with Angular knows the intrinsic problem-solving power of services, so bringing them with me in React was an easy and powerful way to solve some of the problems I was facing in my sample apps.

But React is awesome by itself too.

Yeah, I know, React purists are already taking the pitchforks so let me clear out one thing: React is awesome by itself, even without things taken from Angular. Of course, I'm really enjoying the simplicity of React compared to the structured, more secure but clearly more verbose and harder way of thinking and working in Angular. React is simply javascript with a small but clearly understandable pinch of magic.

Ok Michael, so the question is: Will you move to React?

Yes and no.

I feel really good when I work with React, as it's easy, fast, reactive and does everything I want it to do letting me understand every bit of what I'm doing, instead of the fog you have in Angular in certain situations (Of course, there are many world-class Angular experts here on dev.to, but that's not the case for 90+% of front-end developers who approach Angular on a daily basis and can't easily grasp the inner bits and parts of Dependency Injection and Lazy Routing, for example).

But at the same time, Angular solves different problems, hardly solvable by React without a good dose of patience and self-control, so I guess I'll use both, depending on the occasion.

We are reaching a point where front-end developers are not expected to know just vanilla js and a framework, but to grasp the fundamentals of the whole industry, and I guess having two frameworks in my toolkit could solve me many issues in the future.

What do you think?

If you follow me, you know I always ask people to comment and provide their opinions, so feel free to share yours and let's discuss them together!

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player