I’ve been learning React JS over last couple of days. I haven’t got very far but I’ve learned a bit about it and I’ve created a couple of web apps with it. So I wanted to share my thoughts on it and compare it to Angular 2.
Everyone always says you can’t compare React JS to Angular 2 but I think that’s rubbish.
I know one’s a library (React) and Angular 2 is a framework. But that doesn’t mean you can’t compare them, because if you were to build a new app you would choose React or Angular or a number of other different options. But you wouldn’t build an app with both of them at the same time. You would be choosing between one or the other.
So I think it’s fair to compare them.
They both have their pros and cons and they’re both good for different types of projects.
Angular 1 was the first web framework that I learned. I worked a lot in Angular 1 at a previous role and I thought that the next logical step would be for me to learn Angular 2 when it came out. Because, you know, I don’t want to learn something completely new from scratch.
But it turns out that Angular 2 is completely new. It’s completely different from Angular 1. So at that point I realised, if I’m going to be learning something completely new, I thought I should consider React Js.
Angular is primarily focused around the command-line interface and it’s also in typescript. It’s quite nice to work in typescript. But again you’re practically learning a new language.
React is a bit easier to pick up I found compared to Angular.
It has a basic command-line tool — I think it’s Create React App — which is really cool because it lets you get an app up and running really quickly. So it kind of has that for the CLI. But everything else you basically have to do on your own, which I actually prefer.
I prefer doing things manually instead of using CLIs because I like to actually know what’s going on under the hood.
One of the issues I’ve had with learning React is that I wasn’t really sure what’s going on. What is this web pack that it’s using? If you use the Create React App CLI tool then it creates all of this stuff for you, and don’t even see the config files for web pack and things that it uses behind the scenes. It does it all in the background and it just gives you a running app. And I like to know how it’s working.
It took me a little while to figure that stuff out but then once I did, I found that React is a lot nicer to work with. I prefer the lightweightness of it.
It’s a lot more lightweight than Angular 2. And again, this is because Angular 2 is a framework, so it comes with everything that you need more or less to build a working app. Whereas with React — you’re going to need to you know if you want to do URL routing.
You’re going to need to find your own URL router library that you can add. There’s a great one, I think it’s called React Router.
When it comes to making an app, because React is a library, it’s only one piece of the puzzle. You get to choose all the other things that you use with it. It doesn’t come pre-packaged with a load of different tools that you may never even need to use. So that’s another benefit.
It turns out that React is getting really popular now. At least on this chart from Hacker News Hiring Trends which looks at the different jobs that are out there for the different technologies.
You can see that React just shot right up here.
It’s exceeded that of Angular Js and I’ve put Vue there because it’s apparently getting popular as well. But nowhere near as popular as React.
Given that its popularity is shooting up I think that I’m going to stick with React.
The real deciding factor for me was React Native.
I’ve felt strongly about this type of hybrid technology for quite a while now. I used to use ionic, which is the Angular version of React Native.
But you could always tell with ionic that there were some performance issues. Little things like scrolling just felt differently when doing in the webview versus doing it natively in a native app.
React Native basically compiles your app to native code and if there’s parts of your app that you want to use or write in Swift — or write in Java if you’re doing Android — then you can do that using React Native.
To me, it just doesn’t make sense that mobile apps need to be written in native languages.
I’m not going to sell myself as a highly experienced front-end developer, I’m mostly focused on the back-end stuff. But I do have a fair bit of front-end experience, and from what I’ve seen it just makes sense that React Native would take off. It’s going to be a big thing because it’s just so powerful.
I would love to hear your thoughts on it so if you have an opinion — I know lots of people have strong opinions about this one way or the other — I would love to hear that in the comments.