That said, choosing the right framework to use isn’t easy. Recently Roy Sivan and I published a free mini-course on this subject. You can watch all 4 videos in the series, for free, but I wanted to dive into some of the most popular options here.
Comparing The Major Options
Bottom line, you’re going to want to use a framework, but they’re not all created equal. Here are a few quick thoughts on the pros and cons of the major options.
I have mixed feelings about Backbone. On one hand, it’s included in WordPress, and ships with a Backbone client for the WordPress REST API. At the same time, Backbone is the least magical and oldest of the options I’m discussing here. I have limited experience with it, but I’ve always felt like it wasn’t worth the effort versus DIYing it.
Backbone is the oldest and most stable of the options. That is good and bad. It’s a bit frozen in time, but it works and isn’t changing much. It’s not very modern, but it works and doesn’t change fast, kind of like WordPress. Not changing fast is something that you might want after a bit of time in the fast moving React or Angular ecosystem.
Also, I love that NG1 uses HTML for views. HTML is a great way to write HTML — as opposed to say JSX in React. That said, all of the data attributes you use in an NG1 template can get out of hand real quickly.
React is not the only reactive framework out there, but it’s the most popular. Reactive frameworks are very comfortable for WordPress developers because of the events that the application life cycle emits that you can bind events to. Very much like WordPress hooks.
I’m getting ready to give ReactJS another shot myself. At LoopConf this year, Adam White gave a great talk about the REST API and showed a simple journal app he built in ReactJS. You can watch the talk and read the code, but when I saw it, I wanted to give React another shot. I love the way components are self-contained, yet reusable units.
In Caldera Forms, we recently released a front-end entry viewer feature, powered by VueJS. I love VueJS. It’s a reactive framework, so it provides all of the benefits you want, but it’s also very simple. React is probably the most opinionated framework, and good for you if you agree, while VueJS is the polite and accommodating framework.
Because of its simplicity, you may only need one very small file. This can be good or bad, depending on your use. While VueJS has an official package for HTTP, I tend to use jQuery AJAX because it’s always on the page in a WordPress site anyway. VueJS has packages for a router but recommends others to try. I do like their router for how well it integrates with Vue components. VueJS has a package for state management, but you can use Redux if you wish.
I hope you’re seeing the pattern. React is opinionated, so am I and I don’t agree with React’s opinions. VueJS lets me impose my own opinions.
Also, VueJS’s templates are HTML. The syntax is like a reigned-in version of NG1’s template syntax. Of course, they have a thing like JSX, because that is sometimes needed, but for the most part, HTML templates are all you need.
I’ve been building more and more with VueJS and while it’s making me tempted to try React, I am super happy with it. I am currently working on an app that uses VueJS for the UI, with everything organized into single file components, and the developer experience it great.
Personally, I used to be very satisfied with Angular 1. But, the framework is showing its age and I’ve found myself more drawn to reactive frameworks over time. After looking at React, Preact, JSView, and VueJS, I started to use VueJS more and more. I love how lightweight VueJS is and how fast it is to learn and get started with. I still like using Angular 1, but moving forward I will probably use more VueJS. We use it for the front-end entry viewer in Caldera Forms and it probably will be used in future version of our admin form builder.
I invite you to watch our video series from Caldera Learn where we discuss our preferences and opinions. I’d love to hear your thoughts on which framework is best or if you like one that I didn’t cover here. Please leave a comment and let me know what you think.