React is a great framework for building a heavy UI-focused app. It has a lot more built out of the box that lends itself fundamentally to the “action/hook” mentality that WordPress has. When Automattic released Calypso, built in React, and even used React in the newest JetPack plugin, the masses started to talk React. As is the case, most of the community falls in line as soon as the leads have picked something.
React isn’t horrible, its a great, and very powerful framework. It has a lot to offer to build complex UI’s and many people even like the syntax. The reactive state makes it easy to easily modify the view as data changes, and with the build tools out now, it isn’t even as hard to get up and running as it used to be. I am not a React hater, I have projects I work on that are React, I even have (although needs an update) a boilerplate I built with it.
Let me start at the beginning. I learned Angular when 1.x was the big up and coming thing. Angular 1 (or AngularJS now) is a stable, amazing framework. You can get up and running very quickly, it is easy to see what is going on with the HTML markup, and ultimately it is a very powerful framework to build really cool applications. With the newest version of Angular, it isn’t quite as simple, but it isn’t the same simple framework. Versions 2 and 4 have a lot more going for it in the way of having more potential to build larger applications.
One of the things that makes Angular a hard sell is that it is a lot easier to find “cool tech” companies that run React for their sites. However, that just proves my point a bit. Great at UI. However, Angular powers a lot more than you think, actually a lot more than you would ever know. From talking to many of the developers at ngConf, most Angular applications are actually internal applications for their companies.
Still not convinced it is a thing? Check out MadeWithAngular.com where you will see a mix of projects (both Google and not) that are built using Angular.
A lot of people also moved to React because Angular 2 gave the framework a bad reputation in a lot of communities. It was going to be a huge new update, basically a new framework, and it was in development for so long that people didn’t want to waste their time with AngularJS since they knew it’d be out of date soon, and version 2 wasn’t ready for prime time.
I had to answer the question of why to pick up AngularJS when version 2 was in the looming horizon, and it was easy to make a joke about how long it would be till it finally would be released. All of this did not help.
BTW Angular 4 didn’t help
There are many reasons why Angular 4 came out so quickly after Angular 2, and most of those aren’t known unless you go to the community events or conferences. Suffice to say, there is great reasoning why Angular 4 is out, and why 3 isn’t a thing (it really is…ish).
So now that we got that out of the way, why do I still love Angular? Well I was lucky enough to be able to speak at the major US Angular conference, ngConf, and I got to learn more about Angular than I have in a long time.
While clearly it was an Angular conference, I had many great talks about Angular v. React v. Vue v. “Other” during my few days there. I was talking to people 10 times smarter than I am, building applications and websites that I cannot even dream of building. All of them said each framework had its merits, and this day and age, its hard to be so “fan boy” towards one since you may come across all of them. However the conversation always came back to “Why do we love Angular” and there is a lot to love.
Angular CLI (or ng-cli) has to be the best thing to happen. Everyone in the WordPress world loves wp-cli for great reason, well ng-cli is definitely a close masterpiece.
I just released an early prototype of a new Angular App, that is 100% decoupled from WordPress, but powered by WordPress content. That is to say, it is not running within a WordPress ecosystem, it is running by itself, but displaying and interacting with WordPress content. Building it was 10000000000 times easier with the ng-cli, it took a lot of the grunt work out of it, and since I’m still learning, it was nice to have a base created for me for every component that I know worked, before modifying and adding to it.
I have said that Angular has been much harder to get up and running over AngularJS (1.x), but with ng-cli that is almost no longer the case. You can have a base app up and running locally within minutes.
I hate JSX like, really really dislike. I know I haven’t used it in a while, and I’m sure there are pros to my cons, and even workarounds nowadays… but fundamentally JSX is a React thing, so you get nothing more out of it. Why learn a way of coding a language that is so tightly woven into 1 framework vs. being able to code something that works agnostically?
Again, I need to get back into a React build to say for sure, but form previous experience and even currently looking over tutorials, seems like Angular takes a clear win on how easy it is to template.
Angular Universal is now built in to Angular 4, and it is pretty amazing. It allows for server-side rendering of your Angular application. I know React has this too, but this changes the ballgame for decoupled WordPress applications. You can build your application, powered by WordPress content (and other data), and have it be SEO friendly. You can even tap into a Yoast API and grab all the data you need, per page or post, and display that.. rendered server side.
I’m having an ongoing conversation about Angular Universal and LAMP stack, whether or not this makes sense in a hybrid approach where WordPress powers part of the template, and Angular the meat of the content. Once I can see a performance increase, I’ll create a sample. For now, Angular Universal is meant to run on non-LAMP environments including node.
I’m not the only Angular WordPress developer, I promise you. One of the coolest projects I’ve seen lately is by Ben Moore. He and I had some great chats at LoopConf 2.1 about Angular, and why the WordPress world hasn’t adopted it yet. Check out Ben’s work if you want to see what other developers are up to with WordPress & Angular.