混合使用React和Vue是一个好主意吗? [英] Is it a good idea to mix React and Vue?

查看:1804
本文介绍了混合使用React和Vue是一个好主意吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的公司在另一个国家/地区拥有一个开发团队,他们坚持使用Vue在我们现有平台之上构建新模块.我们的主要平台是基于React与Redux构建的单页应用程序.

My company has a dev team in another country and they insist on using Vue for building new modules on top of our existing platform. Our main platform is a single page app built on React with Redux.

仅基于团队技能的混合框架是一个好主意吗?这两个框架甚至可行吗?

Is mixing frameworks based solely on the team's skills a good idea? Is it even feasible to do for these two frameworks?

推荐答案

如果主要原因是我已经知道Vue",那么我会拒绝.

如果他们已经知道Vue,那么应该很容易学会反应.

If they already know Vue it should be fairly easy to learn react.

我认为这两个框架可以一起工作,您可以在使用Vue构建的React应用程序中拥有一个小功能,因为即使您的SPA位于React中,Vue组件/应用程序也可以定位到任何html元素,并且可以这只是范围.

I think both frameworks can work together, you can have a small feature in your React app built with Vue because even though your SPA is in React, a Vue component/app can be targeted to any html element and have that to be it's only scope.

这种情况将是混合使用两种框架的好用例:

让我们说您已经拥有一个Vue应用程序,该应用程序可以计算出用不同大小的盒子装满卡车的最佳方式,它在逻辑和UI方面有些复杂,但实际上与应用程序中的其他逻辑隔离在那种情况下,我认为将Vue组件/应用程序嵌入到您的React SPA中会很好,因为您无需再次构建它.

Lets say you already have a Vue app that calculates the best way to fill a truck with boxes of different sizes and it's sort of complex in terms of logic and UI, but really isolated from the rest of the logic in your app in that case I think embedding a Vue component/app into your React SPA would be nice because you won't have to build it again.

如何限制Vue组件范围的示例:

<div id="app">
  {{ message }}
</div>

var app = new Vue({
  el: '#app',
  data: {
    message: 'Hello Vue!'
  }
})

在这种情况下,您将拥有仅渲染世界的Vue组件. https://vuejs.org/v2/guide/

In this case you will have a Vue component that only renders hello world. https://vuejs.org/v2/guide/

这篇关于混合使用React和Vue是一个好主意吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆