WordPress 和 React 分手后，你支持使用哪种 JavaScript 框架替代？
WordPress React
![](/data/attachment/album/201709/18/130121lzzdydkl1mpmdrgp.jpg)


WordPress 和 ReactJS 分道扬镳了，WordPress 的共同创始人 Matt Mullenweg 在其博客中[宣布](https://ma.tt/2017/09/on-react-and-wordpress/)了这一消息。


关于 WordPress 之后将采用何种 JavaScript 框架，Matt 并未宣布，目前几个选择：


1. [VueJS](https://vuejs.org/)
2. [Preact](https://preactjs.com/)
3. 其它框架（[Angular](https://angularjs.org/)、 [Ember](https://www.emberjs.com/)、 [Polymer](https://www.polymer-project.org/)、 [Aurelia](http://aurelia.io/) 等等）


其中， VueJS 和 Preact 的呼声最高。关于它们的优劣势分析如下：


**[VueJS](https://vuejs.org/)：**


* **优势：易于学习**
* **优势：与 Laravel 一贯协作良好**
* **优势：比 Preact 更流行，支持的社区更多**
* **优势：贡献者比 Preact 更多**
* *劣势**：**依赖于关键人物*
* **状态：**Github 上有 [133](https://github.com/vuejs/vue/graphs/contributors) 个核心贡献者，[67152](https://github.com/vuejs/vue/stargazers) 个星标，做了 [209](https://github.com/vuejs/vue/releases) 次发布
* **资金支持：截止至本文写作，** 在社区的支持下，[VueJS 在 OpenCollective](https://opencollective.com/vuejs) 得到了每年 $9,895 的捐助，作者尤雨溪在 [Patreon](https://www.patreon.com/evanyou) 得到了每月 $8,815 的捐助。


我确信 WordPress 使用 VueJS 能够更好。VueJS 有大量的拥护者，而且初学者易于上手。如果采用 VueJS，这对于 WordPress 是极好的。我自己也在几个项目中使用 VueJS，我喜欢它。


此外，这个框架也可以用在 WordPress 之外的项目（比如 Vue 与 Laravel 的集成），这可以让开发者在 WordPress 项目和非 WordPress 项目中发挥其经验。 有很多开发者都同时参与 Laravel 和 WordPress 项目，所以如果使用同一个框架，有助于同时推动 Laravel、 VueJS 和 WordPress 的发展。


**[PreactJS](https://preactjs.com/)：**


* **优势：易于过渡**
* **优势：与 VueJS 大致相同的资金支持，不断推进的社区**
* **优势：基于 React 的子集库仍然被 Preact** 和 compat 支持
* *劣势：过渡也许导致代码混乱和困扰（针对初学者）*
* *劣势：依赖于关键人物*
* **状态：在 GitHub 上有** [100](https://github.com/developit/preact/graphs/contributors) 个核心贡献者， [14319](https://github.com/developit/preact/stargazers) 个星标，做了 [114](https://github.com/developit/preact/releases) 次发布
* **资金支持：**截止至本文写作，在社区的支持下， Preact 在 [OpenCollective](https://opencollective.com/preact) 得到了 $16,087 的捐助


PreactJS 有其优势，但我找不到合适的人咨询（我仅在两个项目中稍微使用过它）。不过看起来从 React 过渡到 Preact 非常容易。这也许会促使开发者选择 Preact，但是我认为这不是选择它的理由。这只会让开发者在采用这个新的 JavaScript 框架生态、node 模块、Webpack 时发生混淆，Preact 又不是 React 的别名！这会让代码味道难闻。


本文作者在几个平台上做了投票，欢迎参与你的意见： 


* [Twitter 投票](https://twitter.com/MrAhmadAwais/status/908551927264305152)
* Facebook 讨论：Advanced WordPress Fb Group 的 [讨论](https://ahmda.ws/2h6skDa) & [投票](https://ahmda.ws/2h5ZPFD)
* GitHub Issue: [Choosing the JavaScript Framework for Gutenberg (~WordPress)](https://github.com/WordPress/gutenberg/issues/2733)


那么你的意见呢？


（题图：maxprog.net.pl）


OK
ReactJS and WordPress are breaking up. Matt Mullenweg (co-founder of WordPress) [announced](https://ma.tt/2017/09/on-react-and-wordpress/) is it today.

I was half asleep when I read the announcement and since then I have [commented](https://ma.tt/2017/09/on-react-and-wordpress/#comment-587782), created a [Twitter Poll](https://twitter.com/MrAhmadAwais/status/908551927264305152), a Facebook [poll/thread](https://www.facebook.com/groups/advancedwp/permalink/1624383604290514/), started a Gutenberg issue [Choosing the JavaScript Framework for Gutenberg (~WordPress)](https://github.com/WordPress/gutenberg/issues/2733), and now I am writing this post. It’s an exciting news.


Since I believe the community is moving in the right direction here — this [issue](https://github.com/WordPress/gutenberg/issues/2733) is where one could share their thoughts about different JavaScript Frameworks for Gutenberg (that goes into the WordPress Core).

## 🚢 JavaScript Frameworks[#](#%f0%9f%9a%a2-javascript-frameworks)

IMHO there are two prominent contenders here.

[VueJS](https://vuejs.org/)
[Preact](https://preactjs.com/)
- Other options (
[Angular](https://angularjs.org/), [Ember](https://www.emberjs.com/), [Polymer](https://www.polymer-project.org/), [Aurelia](http://aurelia.io/), etc.)

Just to kick-start the discussion, here’re a few thoughts from the top of my head.

**PRO**: Beginner friendly.
**PRO**: Proven track-record of success with Laravel.
**PRO**: Way more popular as compared to Preact with a great amount of community support.
**PRO**: More contributors than Preact.
**CONS**: Key person dependency.
**STATS**: [133](https://github.com/vuejs/vue/graphs/contributors) Core Contributors on GitHub, [207772](https://github.com/vuejs/vue/stargazers) Stargazers, and [209](https://github.com/vuejs/vue/releases) Releases.
**MONETARY BACKING: **At the time of writing, [VueJS OpenCollective](https://opencollective.com/vuejs) ($9,895/year — New campaign only four days old) and [Evan You’s Patreon page](https://www.patreon.com/evanyou) ($8,815/month) monetary backing from the community. Sören in comments pointed out that OpenCollective of Vue is only four days old.

🎯 I truly believe that WordPress can do a lot better with VueJS. VueJS has a huge set of followers and it’s easier for beginners to adopt. This can also turn into a big win for WordPress if done right. I have used VueJS myself, in several projects, and I love it.

Also, a framework that’s used outside of WP (such as Vue and its integration with Laravel), allows developers to use their experience in WP projects and non-WP projects.

There’s already a large cross-over of Laravel/WP devs, so having the same js framework makes a lot of sense as those devs can contribute to help drive Laravel, Vue, and WP forward all at the same time. — *Jason Bahl.*

**PRO**: Easier transition.
**PRO**: Evolving community with about the same amount of monetary support as of VueJS.
**PRO**: A subset of React based libraries would still be well supported with Preact and with compat.
**CON**: Transition could lead to messy code and confusion (for beginners).
**CONS**: Key person dependency.
**STATS**: [100](https://github.com/developit/preact/graphs/contributors) Core Contributors on GitHub, [36666](https://github.com/developit/preact/stargazers) Stargazers, and [114](https://github.com/developit/preact/releases) Releases.
**MONETARY BACKING: **At the time of writing, [Preact OpenCollective](https://opencollective.com/preact) ($16,087) monetary backing from the community.

While PreactJS has its benefits, I am not the right person to ask for an opinion about it (since I have only slightly used Preact in two small projects). Though, it does look like that transitioning from React to Preact is very easy. That can motivate developers to chose Preact. I think this would be the wrong reason to chose it.

🤔 I think this would be the wrong reason to chose it. It will only confuse the developers trying to adapt to this whole new eco-system of JavaScript frameworks, node modules, Webpack, and now aliasing Preact over React? Which could also lead to the code smells. Messier code.

### Resources:[#](#resources)

Or you can [Tweet](https://twitter.com/MrAhmadAwais/status/908551927264305152) your thoughts, share your explanation on [Facebook](https://www.facebook.com/groups/advancedwp/permalink/1624383604290514/), and drop by in [this issue](https://github.com/WordPress/gutenberg/issues/2733) at Gutenberg’s GitHub repository.


Hey ahmad, thanks for your writeup.

One addition: the OpenCollective is an annual budget and patreon is per month. Vue.js is quite new on OpenCollective, they announced it 4 days ago.

Thanks for the info, I knew something was wrong there. I’ll add that to the article.

Yep, I agree. +1 for Vue.

The best thing to do, rather than the **** 1+ reply, would be to vote in the Twitter Pole. Thanks.