AngularJS和ReactJS [英] AngularJS vs ReactJS

查看:143
本文介绍了AngularJS和ReactJS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我决定要为我的新网络应用程序使用哪个JavaScript框架。
我想使用Angular,但最近听说过React。
问题是 - 我没有找到两者之间真正好的比较。
进行比较的大多数文章是pro-react,并不是一个很大的帮助比较,但只显示为什么反应更好。
eg



https://www.codementor.io/reactjs/tutorial/react-vs-angularjs
http://www.quora.com/Pete-Hunt/Posts/Facebooks-React-vs-AngularJS-A-Closer-Look < a>



任何真实的体验,或比较,说明两者的利弊?
感谢您的输入



UPDATE - 也许一个小例子会有帮助,如何在两个框架中做同样的事情,

:我有一个表中的公司列表。每一行都是1个公司,每一列都是有关公司的一些信息(名称,地址,员工人数..)有很多条目,我需要做一些分页和排序(服务器端)

解决方案

我对React有合理的经验,而且基本上没有Angular。所以我要说的Angular是从我阅读和听到的其他人的东西。



React



优点


  1. 易于学习


  2. Relux的总是重新渲染方式很容易在事情变得复杂时更容易理解

  3. Flux是一个真正的好的替代MVC模式。单向数据流有助于可维护性,并保持数据和DOM元素的一致性。结合Immutable.JS数据结构,它是蛋糕顶部的樱桃:)

缺点 / p>


  1. 不能在DOM操作库中播放(例如:jQuery)

  2. 方式你做事情,特别是如果你使用Flux,这是好的,但它需要一点点习惯。

  3. 我发现一些情况下,重新渲染每次减慢组件处理render方法上的大数据集时应用程序。在这些情况下优化效果可能会有点棘手。



Angular



优惠


  1. 良好的文件


  2. 双向数据绑定使一些事情很容易实现

缺点


  1. 性能问题:要进行双向数据绑定以检查数据模型中的更改。它还必须解析你的HTML,使它的魔术工作。

  2. 逻辑分布在HTML和JS中:代码更难以理解,维护和调试。如果应用程序正在移动设备上运行,

  3. v2可解决某些问题,但会使所有v1代码过时


I am deciding which JavaScript framework to use for my new web application. I wanted to use Angular, but recently heard about React. The problem is - I have not found a really good comparison between the both. Most of the articles which do a comparison are "pro-react", and are not a big help comparing, but only showing why react is better. e.g.

https://www.codementor.io/reactjs/tutorial/react-vs-angularjs http://www.quora.com/Pete-Hunt/Posts/Facebooks-React-vs-AngularJS-A-Closer-Look

Any real experience, or comparison which states the pros and cons of both? Thanks for your input

UPDATE - Maybe a small example would help, how to do the same in both frameworks and compare the pros/cons

Example: I have list of companies in a table. Each row is 1 company, each column is some info about the company (name, address, number of employees..) There are a lot of entries, and I need to do some paging and sorting (server side)

解决方案

I have a reasonable experience with React, and basically none with Angular. So what I'm going to say about Angular is from things I read and heard from other people.

React

Pros

  1. Easy to learn
  2. Isolated components are easier to maintain
  3. The "Always Re-render" way of React is nice to keep it easier to understand when things get complex
  4. Flux is a really good alternative to the MVC pattern. The one-way data flow helps with maintainability and keeping data and DOM elements consistent. Combined with Immutable.JS data structures, it's the cherry on top of the cake :)

Cons

  1. Doesn't play nice with DOM manipulation libs (e.g.: jQuery)
  2. It really changes the way you do things, particularly if you're using Flux, which is good, but it takes a little getting used to.
  3. I found some cases where the re-rendering every time slows down the app when the components handle a large dataset on the render method. Optimising performance in these cases can get a little bit tricky.

Angular

Pros

  1. Good documentation
  2. Members of the community are helpful (it's easy to find good answers here on SO).
  3. Two-way data binding makes some things really easy to implement

Cons

  1. Performance issues: To make two-way data binding it has to check for changes in your data model. It also has to parse your HTML to make it's magic work. This slows things down, and, if the app is running on a mobile device, it drains the battery faster
  2. Logic in spread across HTML and JS: code harder to understand, maintain and debug.
  3. v2 coming to fix some issues, but making all v1 code obsolete

这篇关于AngularJS和ReactJS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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