Vue.js Creator Evan You Weighs in on WordPress JavaScript Framework Discussion

photo credit: JSConf China

Last week WordPress core contributors narrowed their considerations for a new JavaScript framework to React and Vue. As the core team has more collective knowledge of working with React, they have reached out to developers with different experiences of using other frameworks in a WordPress context.

One of the chief concerns contributors have regarding Vue is the longevity of the project. I asked Vue creator Evan You if he could weigh in on the topic to give WordPress contributors a better understanding of the project, specifically regarding his efforts to cultivate additional maintainers to help share the load of maintainership.

“I think it’s important to look at the track record – Vue has been around for almost 4 years, and all the work has been done in public on GitHub so anyone can go and check the maintenance history,” You said. “While it has been largely developed by me, the current maintenance is a lot more community-driven. We have active core team members triaging most of the issues and a larger and larger percentage of the issues fixed by community PRs. So – yes, I had already been working on cultivating additional maintainers and will continue to do so.”

You currently receives $10K/month from recurring Patreon donations that fund his full-time efforts working on Vue. Prior to this he also worked at Google and Meteor. During his time at Google, some of the projects You worked on used Angular, which he said he found to be too heavy for his use cases at the time. He built Vue.js to be a more lightweight implementation of the concepts that he liked about Angular.

You also recently said he has learned quite a bit from the React community, which has influenced some of his technical decisions in Vue 2.

“First, Vue 2 uses the same Virtual DOM based rendering model underneath, which was first pioneered by React,” You said. “Introducing a Virtual DOM allowed Vue to expose the power of vdom composition while maintaining the approachability.

“The React community is also very active when there are new problem domains being explored – e.g. state management and CSS management. There are many competing solutions and a lot of inspirations when I was implementing official solutions for Vue.”

Evan You Addresses WordPress Core Contributors’ Misconceptions about Vue.js

You said he has been following WordPress contributors’ discussions on React vs Vue but would not offer an opinion on which is a better choice for the project.

“My answer would obviously be biased, and honestly I’m not in the shoes of the WP core team so I don’t have enough perspective to make a choice,” You said. “However, I can provide feedback on some of the issues being discussed in hope of helping them make a better-informed decision.”

You left a comment on the most recent Javascript meeting notes with clarifications on a few misunderstandings about Vue.js. You addressed the point regarding “embracing JavaScript the language,” as some contributors think Vue’s templating language obscures the underlying JavaScript.

“I think ’embracing JavaScript the language’ is another primitive of React we don’t see in Vue,” Andrew Duthie said during the last meeting.

You’s reply compares Vue’s use of templates as “syntax sugar for view representation on top of HTML” to what he believes to be a similar usage in the case of JSX as view representation on top of JavaScript:

The increasing richness of UI does NOT necessitate putting everything in JavaScript. On the other hand, just because Vue uses templates by default doesn’t mean it allows people to get by without learning JavaScript properly.

Vue’s templates are compiled into JavaScript render functions under the hood and they are actually closer to JavaScript than to traditional string templating. It’s just a layer of syntax sugar on top of the underlying Virtual DOM representation. Think of JSX as syntax sugar for view representation on top of JS; Vue templates are syntax sugar for view representation on top of HTML.

JSX/Raw JS does provide more flexibility when you need to apply direct manipulation of Virtual DOM nodes, this is why Vue also supports render functions. But this is not putting two opposing paradigms under the same tent – it’s simply allowing the user to skip the syntax sugar layer for more control.

You said the idea behind templating on top of render functions is to provide “better approachability,” a concern shared by many other proponents of WordPress adopting Vue.

“Users who are more comfortable with HTML and have simpler use cases could use the template, while users who are already familiar of JSX/render functions can leverage the full power of JS,” You said. “This would fit pretty nicely for the use of WP core: community users who care about approachability have an easier time getting started, while the core team have access to JSX/render functions for advanced use cases.”

You also addressed the concern of longevity by offering more information on Vue’s development processes. He confirmed that the current codebase is largely developed by him alone, but maintenance is spread across a core team with members all over the world.

“Other contributors have lower commit counts because their contributions are all submitted in the form of PRs and we use the ‘Squash and commit’ feature on GitHub so each PR results in only one commit for the contributor,” You said. “We’ve merged close to 500 PRs in the core repo alone, and many more across the organization. Other repos under the vuejs organization, e.g. vuex, vue-router, vuejs.org are also largely maintained by dedicated team members.”

You also offered clarification on questions of stability and future compatibility, as WordPress contributors presented concerns regarding breaking changes in the templating language in Vue 2.0.

“This begs for some clarification: Vue versioning strictly follows semver,” You said. “The only time there had been breaking API changes post 1.0 was the 2.0 bump. The template syntax is part of the API so it’s not going to [break], and in between major version bumps we commit to 100% API backwards compatibility. We take stability very seriously, so do our community and in-production users, including GitLab, Vice, and some of the biggest internet companies in China.”

As many WordPress core contributors have been developing on top of React for years, You’s input offers a more detailed, in-depth look at Vue that contributors have been asking for during various rounds of feedback. The discussion will continue over the next several weeks and contributors plan to include the topic at WordCamp Europe’s contributor summit.

27

27 responses to “Vue.js Creator Evan You Weighs in on WordPress JavaScript Framework Discussion”

  1. This is a great get Sarah!

    So now I would say one of the additional arguments for using Vue.js is that the core developer for Vue is accessible to the WordPress community and seems willing to accommodate WordPress’ needs. Is there any chance that the React team managers will do similar?

    Also, imaging if Automattic funded $5k/mon to You; half the price of a good JS developer? I’d bet that would get him heavily involved with ensuring that JS integration into WordPress was a major success. But would $5k.month motivate Facebook…?

    • While I understand your point I don’t think buying a framework for strict WordPress integration is the way to go. The Vue / React camp probably wouldn’t want to add featured specifically to accommodate any WordPress needs nor do I think they should have once the decision is made.

      The framework should commit to being better than it was previously without worrying about what WordPress is building or planning to do. I think it is cool that the You is putting in his 2 cents and is being vocal during the process though.

      • The Vue / React camp probably wouldn’t want to add featured specifically to accommodate any WordPress needs nor do I think they should have once the decision is made.

        I was not suggesting they accommodate WordPress’ needs with any kind of bespoke functionality. What I meant was that WordPress’ needs are likely to get a higher prior than the average Joe wanting something added to Vue.

        Assuming Vue had a large number of general purpose feature requests then the few WordPress needs most might get more attention, and sooner.

        • If this is the way forward, automattic can sponsor one of its developers to work on vue….. the problem is that there is still no explanation how does any of the frameworks solve the essential core wordpress JS problems – hooking,localization and dynamically activate/deactivate modules.

          First the problems need to be spelled out, only then a decision can be made, and maybe vue, being smaller and probably more agile, is more likely to agree to add thing to accommodate wordpress needs than react.

          But it is a pointless discussion gutenberg uses react, and with every line of code being written there, the cost of transitioning to anything else becomes higher and less likely to happen.

        • the problem is that there is still no explanation how does any of the frameworks solve the essential core wordpress JS problems – hooking,localization and dynamically activate/deactivate modules.

          I believe the WordPress community will still need to implement its own wp.js framework based on top of whichever JS framework is chosen, if only to deliver those same functionalities, and so that programmers need not re-invent the wheel each time they develop for WP.

          It should not be hard to do: JS objects can register functions under a handle and then execute those functions, to simulate hooking. Localization can be done by passing the already-localized values from the back-end using WP REST API. And activate/deactivate modules can be simulated by loading/not-loading components (either from React or Vue).

          A wp.js may even abstract the chosen JS framework to resemble as much as possible WP, so that developers will still feel at home when programming using JS and not PHP.

      • That is likely very true.

        But it is also orthogonal to my assertion, which was that WordPress is likely to get more attention from the developer(s) of Vue than from the developer(s) of React. Regardless of whether there are other organizations that get more attention that WordPress.

  2. React should have never even been considered because it’s license allows Facebook to revoke your use of React if you compete with Facebook.

    What happens if you build a great WordPress/React based project, then Facebook decides to enter your domain? Do you have to then shut-off your project until you build it in another JS framework?

    React is pseudo open-source. Why would WordPress ever consider aligning with it?

    • Using React gives FB the ability to revoke your license if you file a legal complaint against them for IP infringement.

      So, you create something cool and you patent or trademark it. FB decides they want it, so they steal it. You file a legal proceeding against them. They revoke your license. You may be right but you’ll starve while watching your bank account vanish in attorney/court costs, while they get an injunction against you so you have to yank React out of your project.

      Not a big risk for the sole developer making plugins for the knitting club. But infect WP core with this and the stakes will be much higher.

  3. Another important point of view about choosing React vs Vue for our WordPress project was issue with React license. It has a very strange part:

    The license granted hereunder will terminate, automatically and without notice, if you (or any of your subsidiaries, corporate affiliates or agents) initiate directly or indirectly, or take a direct financial interest in, any Patent Assertion: (i) against Facebook or any of its subsidiaries or corporate affiliates, (ii) against any party if such Patent Assertion arises in whole or in part from any software, technology, product or service of Facebook or any of its subsidiaries or corporate affiliates, or (iii) against any party relating to the Software. Notwithstanding the foregoing, if Facebook or any of its
    subsidiaries or corporate affiliates files a lawsuit alleging patent
    infringement against you in the first instance, and you respond by filing a patent infringement counterclaim in that lawsuit against that party that is unrelated to the Software, the license granted hereunder will not terminate under section (i) of this paragraph due to such counterclaim.

    • I have no particular opinion in this discussion, but this interested me, so I went and had a look at the license. Seems pretty clear to me that this is patent-troll protection. They revised it a few times, and it’s quite clear now what their intentions are.

      Anybody saying otherwise isn’t really reading the thing. This seems like a non-issue.

      • Actually, Otto, it’s a huge issue for precisely the reason that chuck has given above:

        So, you create something cool and you patent or trademark it. FB decides they want it, so they steal it. You file a legal proceeding against them. They revoke your license. You may be right but you’ll starve while watching your bank account vanish in attorney/court costs, while they get an injunction against you so you have to yank React out of your project.

        And yes, I’ve read the thing. If Facebook just wanted patent-troll protection, it would have used the Apache 2 license. There’s a reason it didn’t.

      • I generally don’t try to infer intentions of a company by reading their contract language. I read the contract with the understanding that it alone will be exhibited in any legal proceeding. I’ve never been in a court where the judge called for the review of intentions.

        With that perspective, re-read the license and tell me if you get to the same conclusion, given this scenario:

        a. You are a SW company that incorporates React as a key technology in your product.

        b. You later find that FB is infringing on your intellectual property, so you file a legal complaint against them.

        Are you confident enough in the written contract to conclude that since you are not a nasty patent troll FB will forgo their right to revoke your license?

        Or, will they see the leverage they have over you and act upon it?

        (hint…it’s the second answer…)

  4. From all the topic comments I’ve read, it looks like 75% of the community wants Vue instead of React ( a completely unscientific estimation ). Personally, I don’t care as long as React isn’t the framework used. I think it goes against the development simplicity that WordPress currently possesses.

Newsletter

Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.