- It’s enormous and atomized, with dozens of suggested technologies (from task runners to package managers to transpilers) working to complement any framework choice
- It’s incredibly frothy, with frameworks rising and falling on a timescale of months
What ReactJS Is
ReactJS is a framework for building user interfaces, built by Facebook initially for internal use on Facebook and Instagram, and later open-sourced.
Just the View By Default (and Why That’s a Good Thing)
By default, React only handles displaying data. That could make it perfect for WordPress developers, who can often use WordPress itself as the backend.
Unlike other frameworks, React by default only displays data. It doesn’t store your data for you, or give you immediately built-in ways for the underlying data that’s driving your application to be changed or updated. For example, in a recipe application, React could easily display a list of recipes that it was given, perhaps as a REST API endpoint; but it wouldn’t natively, all by itself, have a place where you store the data for that list, nor would it have the machinery for a “My Account” page with a bunch of saved and starred recipes.
In my experience, this makes React relatively easy to learn, because you’re just learning a new way to cause data to show up in the browser, without a lot of other immediate baggage from a system which is concerned with structuring and manipulating underlying data.
This also makes React potentially perfect for a WordPress developer, since on a lot of projects we bring our choice of backend—WordPress itself, serving data through REST API endpoints—along with us.
Also, with other tools that I don’t understand yet, in particular Redux, React can have much fuller state (data) modeling and manipulation. So React, with some immediately adjacent tools, really can be a full-fledged framework; it can be more than a View layer, but it doesn’t have to be.
What Makes ReactJS Attractive
Now that we’ve said a bit about what ReactJS is, let’s talk about why it’s attractive—especially for what I believe is the pretty common profile of “well-meaning developer based in another technology.”
1. ReactJS is Large, Popular, and Stable
If you’re looking for a technology with good documentation that isn’t going to vanish in six months, ReactJS has an awful lot of things going for it:
React is Stably Maintained by Facebook.
React will live as long as Facebook cares to support it, which will be quite a while.
As a case in point: I considered learning AngularJS, but Angular 2 is out and is vastly different from Angular 1 because of a huge number of improvements that also represent breaking changes. This makes it just about impossible to jump in and learn Angular, because it means that the oldest and best-vetted documentation for Angular—Stack Overflow posts, video tutorials, and so on—will all be wrong because they’re referring to an old flavor of Angular. I’m also not eager to invest in something that wishes me to relearn everything every two years, as well-intentioned as the breaking changes may be.
React, by contrast, is stably piloted by Facebook, and this corporate sponsorship means that React will be supported as long as Facebook cares to do so—which is, on average, going to be a lot longer than how long a group of volunteers will be able to actively develop their own framework idea, especially as that idea slides off the top of the hype heap.
React’s Documentation is Very Good.
React is in a lovely part of its lifecycle where it’s been both very hot and also around for a bit. As a result, I’ve never had a question in React whose answer I couldn’t readily find through a Google search. The main documentation from Facebook themselves is outstanding, as well—which, again, I feel speaks to the good health that emanates partly from its sponsorship by an ungodly-rich corporation.
As an illustration, I would consider learning VueJS, the possibly-hottest-JS-tool-right-now, but I’m worried the documentation won’t hold up, and this is borne out even in highly complementary reviews: “Unfortunately, there are nowhere near the resources available [for Vue] as there are for React, Angular, Ember, Elm, Backbone… you get the point.”
2. ReactJS is Pretty Simple to Learn
Ultra-basic ReactJS feels like it largely revolves around three main concepts:
props, and the
I learned ultra-basic React in the course of writing a WPShout article on the topic—meaning not more than a few hours of frustration.
.js files besides the main
react.js were optional. Not so.
Once you’re there, though, you’re left with probably three main concepts:
props, and the
render() function. There are outstanding demos that explain each one, and once you get the idea that “state should be in the highest-level components and flow down into lower-level components as props,” the whole thing makes a lovely amount of sense.
Contrast this to Angular (I guess specifically 1)’s famous “hockey stick” of difficulty once you get into the topic of two-way data binding, and I’ll argue that React has a more gentle and less I-quit difficulty curve than many of the primary alternatives.
And, of course, there’s always more to learn before I actually know what I’m doing. Fortunately, it’s all in the form of independent components, like Redux. Once I want to manage state more intelligently, I’ll be able to learn Redux; it’s not something I have to learn to be able to do anything at all, the way the many core concepts of a larger framework would be.
2. ReactJS Lets You Build Native iOS and Android Apps(!) with React Native
Crazily enough, ReactJS is also your route into becoming a mobile app developer, through React Native.
I’ve saved the absolutely craziest part for last: ReactJS is also your route into becoming a literal mobile app developer, with React Native.
I’ve verified this myself: I have an Android app, on my phone, that I wrote in a few hours through React. I’m going to build the iPhone version—using almost the exact same ReactJS code—as soon as I can delete enough space off my girlfriend’s Mac to download the iOS SDK.
On that topic: as a piece of advice, don’t attempt to use React Native on a Windows machine. The setup steps are hideously frustrating, and you can’t develop iOS app on PCs thanks to a bit of lock-in by Apple. This would be a great time to treat yourself to a Mac.
Obviously, “this-to-that” software projects always sound a little suspicious, but React Native isn’t some sort of fragile hack: it’s a fully functioning alternative to developing mobile apps directly in Java and Swift, used happily by big-time folks like SoundCloud.
This is opening up an entire new world to me: WordPress websites as data stores, with mobile apps that consume that data into an intimate and accessible user experience. Only a few of my clients will get value from this, but I’ve already spoken to two of them since starting to learn React Native. (“When you’re a hammer…”)
And, again, I’ve only spent maybe a total of ten or twenty hours being stuck or confused—contrasted to the maybe 150 hours I spent in that state trying to learn Java-based Android development a couple of years ago.
Thanks for reading!