Matt Mullenweg recently announced that the WordPress project will no longer use the phenomenally popular React framework in its projects. React was being used to build the forthcoming Gutenberg editor, which will now have to be rewritten.
WordPress theme and plugin developers don’t have to follow the lead of the WordPress project. They can use whichever front-end technology they like to interact with the WordPress REST API, but if you are embarking on a new WordPress plugin or theme, it’s worth knowing about the alternatives — and there are a lot of alternatives.
If you’re interested in why WordPress is moving away from React, I discussed the nitty-gritty in an earlier post, so I won’t go into detail here. Suffice it to say that Facebook, which develops React, releases the code under a license that doesn’t sit well with many open source developers.
I’ll have a look at three alternatives to React later in this post, but the way we choose a framework is at least as interesting as the framework we choose. I’ll suggest three principles that might be useful to you:
- Choose a framework your developer already knows.
- Choose a framework the community is invested in.
- Unless you have a compelling reason to move away from React, don’t.
The goal is to build things. Any of the major contenders in this space is adequate to that task. If you or the developer you hire is already familiar with a framework, there’s no real reason to switch (unless it’s so obscure you won’t be able to find anyone to maintain the code).
At the time of writing, the WordPress community hadn’t settled on a React alternative. When it does, developers will start pumping out code. They’ll ask and answer questions on Stack Exchange and WordPress developer forums. They’ll write demo themes and plugins. In short, whichever framework the community decides on is a good bet for developers.
If you have already invested in writing lots of React code for your project, think long and hard before you decide to move to a different framework or library. React is awesome: that’s why it’s so popular. Some organizations, including WordPress, have specific problems with the license. If you don’t think those problems are relevant to you, there’s no real need to change.
I’m not a betting man, but Vue is by far the most popular of the React alternatives, and it would be an obvious choice. Indeed, it seems that the WordPress folks have been in conversation with Vue’s developers. The transition from React to Vue may not be smooth sailing because the underlying principles are different (no JSX-type shenanigans), but Vue is a solid choice.
Preact is a lightweight alternative to React that, unlike Vue, uses the same API. It’s very easy to transition from React to Preact, and there is a compatibility layer that allows developers to use React code with the Preact framework. If you’re looking for a direct replacement for React, you won’t go far wrong with Preact.