博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Angular vs React – Angular和React之间的区别
阅读量:2508 次
发布时间:2019-05-11

本文共 6728 字,大约阅读时间需要 22 分钟。

If you are a web developer and stumbling around which platform should you choose for your next project, Angular or React? Then, you are at the correct place. Also, if you are a beginner in web development, you will surely come across with Angular and React soon.

如果您是一名Web开发人员,并且在为下一个项目Angular或React选择哪个平台时遇到问题? 然后,您来对地方了。 另外,如果您是Web开发的初学者,那么您一定很快就会遇到Angular和React。

In this article, we are going to discuss what Angular and React is? What are their key differences, similarities, and various other factors to get a better understanding.

在本文中,我们将讨论Angular和React是什么? 他们的主要区别,相似点和其他各种因素有哪些,以便更好地理解。

So, let’s get started.

因此,让我们开始吧。

什么是Angular和React? (What is Angular and React?)

Angular is a complete structural framework for development of dynamic web pages and web applications. It is a JavaScript framework developed and maintained by Google that is written in Typescript. Angular is a complete rewrite of Angular JS which was introduced in 2010. Also, Angular has a different syntax format and instead of controllers it uses a hierarchy of components for its architecture.

Angular是用于开发动态网页和Web应用程序的完整结构框架。 这是由Google开发和维护JavaScript框架,以Typescript编写。 Angular是对2010年引入的Angular JS的完全重写。此外,Angular具有不同的语法格式,并且在其体系结构中使用了组件层次结构来代替控制器。

React popularly known as React.js or React JS is an open source JavaScript library developed and maintained by Facebook. It is basically used for developing single page or application as it can fetch rapidly changing data and record them. It was introduced in 2013 and was described as a JavaScript library for building user interfaces.

React俗称React.js或React JS是Facebook开发和维护的开源JavaScript库。 它基本上用于开发单个页面或应用程序,因为它可以获取快速变化的数据并进行记录。 它于2013年推出,被描述为用于构建用户界面JavaScript库。

Both Angular and React frameworks are developed and available under MIT license.

Angular和React框架都是根据MIT许可开发和提供的。

Angular vs React (Angular vs React)

Angular vs React - Difference Between Angular and React

建筑 (Architecture)

Angular and React both have many similarities and differences. If we compare Angular with React, then we see that Angular is completely a MVC (Model View Controller) framework as it helps in building the structure of application but React is just a JavaScript library – only the view.

AngularReact都有许多相似之处和不同之处。 如果将Angular与React进行比较,我们会发现Angular完全是一个MVC(模型视图控制器)框架,因为它有助于构建应用程序的结构,但是React只是一个JavaScript库-仅是视图。

On the other hand, React gives you complete flexibility for choosing any of your own library as you wish to. In addition, it also provides JSX and XML templates instead of just classic templates as in Angular.

另一方面,React使您可以完全灵活地选择自己想要的任何库。 此外,它还提供JSX和XML模板,而不仅仅是Angular中的经典模板。

Angular does not gives you much flexibility as React. You have to only use what angular provides.

Angular不能像React那样给您带来很大的灵活性。 您只需要使用angular提供的功能即可。

数据绑定 (Data Binding)

This is one the major differences between Angular and React. Angular uses two-way data binding while React uses one-way data binding.

这是Angular和React之间的主要区别之一。 Angular使用双向数据绑定,而React使用单向数据绑定。

Let me explain you by a simple example – In two-way data binding, if a user input changes than the state of the model changes as well. And if you change the state of model then the corresponding input changes. This is how two-way data binding works.

让我通过一个简单的示例进行解释-在双向数据绑定中,如果用户输入发生变化,而模型的状态也发生变化。 而且,如果您更改模型的状态,则相应的输入也会更改。 这就是双向数据绑定的工作方式。

React uses one-way binding. In this first we have to update the model state and then only we can change the user input. However, if we change the user element it will not affect the model state.

React使用单向绑定。 首先,我们必须更新模型状态,然后才可以更改用户输入。 但是,如果我们更改用户元素,则不会影响模型状态。

母体技术 (Parent Technology)

Angular uses Typescript language while React uses JavaScript language. Both languages are different in a way that JavaScript is a dynamic language rather than Typescript which is static language.

Angular使用Typescript语言,而React使用JavaScript语言。 两种语言的不同之处在于JavaScript是一种动态语言,而不是Typescript是静态语言。

In JavaScript we don’t have to define the variable type like string, char, int etc. It dynamically allocates memory to the variable. While in Typescript, we have to statically define the variable type.

在JavaScript中,我们不必定义变量类型,例如字符串,字符,整数等。它可以动态地将内存分配给变量。 在Typescript中,我们必须静态定义变量类型。

The Angular uses Typescript as it provides smooth transition for programmers.

Angular使用Typescript,因为它为程序员提供了平滑的过渡。

DOM(文档对象模型) (DOM (Document Object Model))

Angular uses regular DOM in comparison to React which uses Virtual DOM. Virtual DOM helps in increasing the speed of changing and updating the data without changing the structure.

与使用虚拟DOM的React相比,Angular使用常规DOM。 虚拟DOM有助于在不更改结构的情况下提高更改和更新数据的速度。

While on the other hand in regular DOM, the whole structure needs to be updated until we reach the data that needs to be updated. This leads to slow performance of Angular than React.

另一方面,在常规DOM中,整个结构需要更新,直到我们到达需要更新的数据为止。 这导致Angular的性能比React慢。

Angular和React之间的区别 (Difference Between Angular and React)

Basis Angular React
Developed By Google Facebook
Platform Complete MVC framework for building web pages and applications JavaScript Library for developing single page
Templates HTML templates JSX, XML templates
Data Binding Uses two-way data binding Uses one-way data binding
DOM Regular DOM Virtual DOM
Language Used Typescript JavaScript and JSX
Flexibility Only Angular tools can be used Provides option to choose any templates
State Management No need of Redux until the requirement is high enough Redux is used for state management
基础 角度的 React
由开发 谷歌 脸书
平台 用于构建网页和应用程序的完整MVC框架 用于开发单页JavaScript库
范本 HTML模板 JSX,XML模板
数据绑定 使用双向数据绑定 使用单向数据绑定
DOM 常规DOM 虚拟DOM
使用语言 打字稿 JavaScript和JSX
灵活性 只能使用Angular工具 提供选择任何模板的选项
国家管理 直到需求足够高时才需要Redux Redux用于状态管理

Google趋势 (Google Trends)

According to google search trends React is more popular than Angular. The does not mean Angular is not good, both have there own advantages and disadvantages.

根据谷歌搜索趋势,React比Angular更受欢迎。 这并不意味着Angular不好,两者都有各自的优缺点。

Final Thoughts

最后的想法

Both Angular and React are widely used by professional developers, businesses, and various other companies worldwide. Angular is a complete framework and has always gained popularity since its release. And same applies on React too, but its not a framework rather it’s just a library to view.

Angular和React都被专业开发人员,企业和全球其他各种公司广泛使用。 Angular是一个完整的框架,自发布以来一直很受欢迎。 同样也适用于React,但它不是框架而是一个可供查看的库。

React and Angular are two different things, but still they both are compared because they are the most widely used technology for developing web pages and applications. React has some amazing features, that’s the reason it is compared to Angular.

React和Angular是两个不同的东西,但是仍然将它们进行比较,因为它们是用于开发网页和应用程序的最广泛使用的技术。 React具有一些惊人的功能,这就是它与Angular相比的原因。

About Author:

关于作者:

The author is a tech enthusiast who loves to write about technology. You can read more articles written by him at

作者是一位热衷于技术写作的技术爱好者。 您可以在阅读他撰写的更多文章

翻译自:

转载地址:http://dvggb.baihongyu.com/

你可能感兴趣的文章
CentOs7安装rabbitmq
查看>>
(转))iOS App上架AppStore 会遇到的坑
查看>>
解决vmware与主机无法连通的问题
查看>>
做好产品
查看>>
项目管理经验
查看>>
笔记:Hadoop权威指南 第8章 MapReduce 的特性
查看>>
JMeter响应数据出现乱码的处理-三种解决方式
查看>>
获取设备实际宽度
查看>>
Notes on <High Performance MySQL> -- Ch3: Schema Optimization and Indexing
查看>>
Alpha冲刺(10/10)
查看>>
数组Array的API2
查看>>
为什么 Redis 重启后没有正确恢复之前的内存数据
查看>>
No qualifying bean of type available问题修复
查看>>
第四周助教心得体会
查看>>
spfile
查看>>
Team Foundation Service更新:改善了导航和项目状态速查功能
查看>>
WordPress资源站点推荐
查看>>
Python性能鸡汤
查看>>
android Manifest.xml选项
查看>>
Cookie/Session机制具体解释
查看>>