📅  最后修改于: 2020-12-19 03:48:55             🧑  作者: Mango
React和Vue是目前最受欢迎的两个JavaScript库,用于构建数千个网站。 React和Vue都是非常强大的框架,具有各自的优缺点。您必须选择哪一个取决于业务需求和用例。
React和Vue都有很多共同之处,例如基于组件的体系结构,虚拟DOM的使用,道具的使用,用于调试的chrome Dev工具等等。但是,两者都有一些显着差异,如下所示。
React | Vue | |
---|---|---|
Definition | React is a declarative, efficient, flexible, open-source JavaScript library for building reusable UI components. | Vue is an open-source JavaScript library for building reusable user interfaces and single-page applications. |
History | It was created by Jordan Walke, a software engineer at Facebook. It was initially developed and maintained by Facebook and later used in its products like WhatsApp & Instagram. Facebook developed React in 2011 for the newsfeed section, but it was released to the public on May 2013. | Vue was created by Evan You, a former employee of Google worked on many Angular projects. He wanted to make a better version of Angular, just extracting the part which he liked about Angular and making it lighter. The first release of Vue was introduced in February 2014. |
Learning Curve | React is not a complete framework, and the more advanced framework must be looked for the use of third-party libraries. It makes the learning of the core framework not so easy. It adds some complexity to the learning curve as it differs based on the choices you take with additional functionality. | Vue provides higher customizability, which makes it easier to learn than Angular or React. Vue shares some concepts with Angular and React in their functionality. Hence, the transition to Vue from Angular and React is an easy option. Also, the official documentation is well written and covers everything the developer needs to build a Vue app. |
Preferred Language | JavaScript/JavaScript XML | HTML/JavaScript |
Size | The size of the React library is 100 kilobytes (approx.). | The size of the Vue library is 60 kilobytes (approx.). |
Performance | Its performance is slow as compared to Vue. | Its performance is fast as compared to React. |
Flexibility | React provides great flexibility to support third-party libraries. | Vue provides limited flexibility as compared to React. |
Coding Style | React uses JSX for writing JavaScript Expression instead of regular JavaScript. JSX is similar to HTML code within the JavaScript expressions. React takes everything as Component, and each component has its own lifecycle methods. | Vue coding style is little similar to Angular. It separates HTML, JS, and CSS as like web developers have been used to the web development scenario for years. But, it also allows using JSX if you prefer. Vue’s take of the component lifecycle more intuitive than React’s. |
Data Binding | React supports one-way data binding. The one-way data binding refers to a single source of truth. React flows in a single direction, and only the model can change the app’s state. | Vue supports both one-way and two-way data binding. The two-way data binding is a mechanism where UI fields are bound to model dynamically. If the UI components change, model data is also changed accordingly. |
Tooling | React has great tooling support. It uses third-party CLI tool (create-react-app), which helps to create new apps and components in React Project. It has excellent support for the major IDEs. | Vue provides limited tooling support as compared to React. It has a Vue CLI tool, which is similar to the create-react-app tool. It gives supports for major IDEs but not as good as React. |
Current Version | React 16.8.6 on March 27, 2019 | Vue 2.6.10 on March 20, 2019. |
Long Term Support | It is suitable for long term supports. | It is not suitable for long term support. |