一些关于AngularJS和ReactJS的资料

RegularJS资料整理 据说,RegularJS是基于动态模版实现的用于构建数据驱动型组建的新一代类库。结合了AngularJS的脏检查机制的数据双向绑定和ReactJS组件化的思想,用起来应该和VueJS差不多(因为我没用过VueJS)。 RegularJS是极具网易特色的库,项目中在用,稍微研究研究。搜索了一下网上所有有关的资料,还真的不多。这是我能找到的所有靠谱资料。 官网资料 http:// 阅读详情

AngularJS:


Everything you need to understand to start with AngularJS   介绍了AngularJS的主要构成

AngularJS Tutorial – Learn AngularJS in 30 minutes    介绍了Controller, Scope, Binding, Filtering, Hiding and Showing, Click event

Learn AngularJS With These 5 Practical Examples      介绍了5个例子:Navigation Menu, Inline Editor(双向绑定),Order Form(类似于购物车算总价钱),Instant Search(自定义filter),Switchable Grid(切换instagram的grid和list显示方式)

ANGULAR JS TUTORIAL   demo    一个通过控制scrollbar来画圆形的例子

A Step-by-Step Guide to Your First AngularJS App    一个list的例子,有过滤功能

AngularJS入门教程  


ReactJS:

一个jsfiddle的HelloWorld例子

React JS and JavaScript in Facebook     一个facebook工程师对ReactJS的中文科普


ReactJS 和 AngularJS的区别:

General

React has been open-sourced by Facebook in June 2013 and is battle-tested by on Facebook and Instagram. It has a small but growing community. The React team is very responsive and helpful on IRC.

AngularJs, supported by Google, is here since 2009 and has already a pretty huge community. Google did not use AngularJs in any of its major projects but many people have Angular projects in production.

We can estimate the community size based on IRC channel frequentations: 130 for #reactjs VS 600 for #angularjs on Freenode.


Angular is MVC, React is just V

React is much smaller than Angular. It does not have a service layer, prebuilt services to do routing or ajax requests, controllers, dependency injections, tools to enhance the testability. It is just the V in MVC, as stated in their home page.

On Facebook and Instagram, React is used with some other infrastructure tools, like a Backbone router (which will be replaced soon by Flatiron Director).

The official documentation examples shipped with React give an idea of how React can be used with external tools. Currently we can find examples for:

  • React only
  • React + Director router
  • React + Backbone models

There's not yet an example of React + Angular but the two can be used together. You can keep the M and C of Angular if you like this part, and use the V of React.

There is an ngReact experimental project: the author creates directives to use React inside an Angular enhanced DOM.


React usecases?

Any React component can easily be replaced by an Angular directive with an isolate scope and a template. Everything you can do in React can be done in Angular. So why would one use the V of React?

The major difference in Angular V and React V is how the DOM modifications are handled. The DOM access is slow and can be a bottleneck.

On each state modification, React computes a virtual DOM. To modify the real DOM, if makes a diff between the newly computed virtual DOM and the previously computed virtual DOM, and then it applies the diff to the real DOM. The triggering to the virtual DOM computation is done explicitly and the framework does not need to dirty check the state. The React team states that it gives better performances.

In Angular, the dirty checking permits to trigger the rendering of the DOM which is manipulated directly in the directives.

The goal of Angular is to make development easy and have reasonnably fast rendering performances. The author of Angular states that under 50ms the difference is nearly imperceptible. The authors of React states that it is perceptible, particularly in touch devices, and tries to make it under 16ms.


Similarities between React components VS Angular directives

A React component is like an Angular directive with an isolate scope. React props are a bit like an isolate scope without the 2-way data binding, so you can only use @ and & , not =. (Actually you can use =and modify React props but you shouldn't, because it won't trigger any rendering, because there is no dirty checking)

Angular directive:

.directive('myPersonComponent', function() {
 return {
   restrict: 'E',
   templateUrl: 'templates/person.html',
   scope: {
     personModel: '@',
     onPersonClick: '&'
  }
};

// Parent code:
<my-person-component 
person-model="personToRender" 
on-person-click="makeControllerRenderPersonWithId(personToRender.id)">
</my-person-component>

You can interact with the parent scope state through a function. You can also use transclusion (not shown here)

React component:

First of all, don't be surprised by React strange syntax. The DOM nodes returned are not real DOM nodes but virtual DOM nodes and the source you can see here is compiled into normal javascript. In React the directive and its template are all put together.

var PersonComponent = React.createClass({
  render: function() {
    return (
      <div className="person" onClick={this.props.onPersonClick}>
        // Use {this.props.personModel} to display the person data
      </div>
    );
  }
});


// Parent code:
var personModel = ...
var onPersonClickFn = doRenderPersonWithId.bind(this,personModel.id);
var myComponent = <PersonComponent personModel={personModel} onPersonClick={onPersonClickFn}/>

React.renderComponent(myComponent,domNode);

You can interact with the parent component state through a function, like in Angular. Props of a component should be kept immutable.

You can also use this.props.children which is the equivalent of Angular transclusion and permits to create useful wrapper components like Popup, Dialog...

var Popup = React.createClass({
  render: function() {
    return (<div className="popup">{this.props.children}</a>);
  }
});

var popup = <Popup>Popup content</Popup>,

React.renderComponent(popup,domNode);

Performance feedbacks

The author of BirdWatch uses AngularJs and reimplemented in a branch his project in React + ScalaJs and found out that there were better DOM rendering performances with React. You can some interesting stuff on his blog.

While using ngReact experimental project: the author observed better performances on simple cases. At first there were problems with the ngReactRepeat directive but it seems fixed now.

The ClojureScript's Om library based on React has pretty good performances on TodoMVC benchmark.

Both libraries provide some performance hints. React permits through shouldComponentUpdate(oldProps,newProps,oldState,newState) to avoid computing unnecessary virtual DOM tree parts. AngularJs community has projects like bindonce which permit to disable the 2-way databinding to reduce the dirtychecking time when it's not needed.


My opinion

I like both frameworks. Angular provides a nice infrastructure, a big community and really focus on testability. React still lack of good practice documentation and you have to choose how to use it.

React is much easier to learn than Angular which I find sometimes quite hard when you want to create specific directives that interact with each others. It is worth investing little time in it, you'll be able to use it really soon.

React is easy to reason about because the immutable component props are your single source of truth, like the scope in Angular.

However I think if you don't have performance issues with Angular, there's no need to try to use React because React will probably only give you better performances, and everything you can do in React can also be done in Angular.

I would recommend taking a look at ClojureScript's Om library which uses React. Using immutable data structures permit to change the application state and to be able to optimize the comparison of 2 objects by relying on identity/reference check instead of deep equality. This is useful to reduce the time spent in shouldComponentUpdate for React and I guess the same logic may be used with Angular to avoid using the objectEquality=true argument of the $watch method


http://stackoverflow.com/questions/21111217/react-vs-angular




backbone, AngularJS, EmberJS 的一些比较:

1 backbone. 对于初学者来说,我非常建议首先学习backbone 而不是jQuery. 因为jQuery提供的功能是操作DOM和Ajax数据传输. 而Backbone的功能和目的仅仅是提供一个javascript的MVC 实际针对Web就是 MVR. (Model, View, Router路由). 对于初学者有一个良好的代码结构,而不是一上来就用jQuery频繁操作DOM,导致代码很难维护.

backbone功能仅限于此. backbone 提供了Model层处理前端数据模型, Router提供了前端页面路由(目前大多数都是后端提供页面路由,所以可以不用). View提供了页面视图的模块化和作用域.(完美解决了jQuery一个页面多次出现同一个组件通过id或class操作dom而导致无法分别哪个组件问题). View也自带自己的模板引擎.

backbone没有提供任何额外的功能. 例如操作dom还是用jQuery, 数据传输也是基于jQuery的ajax通过Model封装了rest.

backbone还依赖一个非常好用的库 underscore.js 这个库封装了大部分js对象,数组操作, 例如循环,遍历,map, filter对象某个属性, 删除某个属性等等. 很方便

所以backbone其实也是一个库,而不是框架

2 Angular, 目前在项目中完整大规模使用. Angular官方定位 HTML enhanced for web apps(增强目前web app) 和 AngularJS — Superheroic JavaScript MVW Framework (英雄般的MV 无论什么结构层次都支持的框架)

angular 目前的发展节奏就是 大而全, 就是你有我有全都有. 使用angular后,你不需要任何依赖其他库. angular都会有,现在没有以后也会加入.

angular 功能包括
2.1
数据绑定 就是MVVM 结构, 目的就是让开发者完全忘记操作DOM, 只需要操作数据,html页面就会自动更新
例如 var shownumber = 1, 那么你把shownumber = 2 时, 界面就自动更新了, 完全不需要用jQuery用.html()或.text()更新数据. 就这个绑定功能,目前大部分网站的js代码都能删掉 三分之二.

2.2 模块系统, angular 有自己的模块系统, 不需要在用require js 或其他模块系统. 目前第三方模块已经很多http://ngmodules.org/

2.3 数据传输 内置$http,取代了jQuery的$.ajax 而且内置promise,非常好用. 同时有官方做的$resource 模块 支持restful 接口

2.4 操作Dom 内置了一个简化版本的类似jQuery的angular.element, 完全可以不用$ jQuery. 同时提供大量内置的ng- 开头的指令系统通过在html模板中 声明式绑定 解决操作DOM问题. (声明式指令简直就是对不懂js的前端开发的福音,再也不用js的.show(),.hide()了, 直接写到html标签上)

2.5 页面路由系统

2.6 内置一套非常好用结合html5的表单验证系统

2.7 内置ng-指令开头的事件系统 例如ng-click等

2.8 内置非常贴心的过滤器系统, 例如你先把时间写成2012.01.01 只要用 data | xxxx-xx-xx ,或 货币符号把人民币改成美元 {{amount | currency:"USD$"}} ,真贴心.

2.9 集成数组对象操作方法, 看来underscore.js也不需要了. angular.xxx 开头的方法一大堆. (目前我还是用underscore)

2.10 动画效果, angular1.2版本后分为独立的模块 ng-animate 非常方法,只要在html写上样式名字动画自动就出来了,完全不用操心js代码

2.11 操作cookie的模板

2.12 移动端事件模块

2.13 html 标签过滤器, 防止非法字符什么的.

还有很多, angular定位就是大而全. 其实也能感觉到"框架" 与 "库" 的区别

3 Ember 定位是框架, 原来是苹果公司的内部项目.
ember提供了MVC结构 和 backbone 非常像.
但ember的view集成了数据绑定功能. 使用handlebar 作为模板引擎, (angular模板是DOM模板 和 backbone,ember都不一样)
Ember 还集成路由, 各种贴心易用的属性操作方法, restful ajax.
但Ember 对比angular 还是没有那么多功能.


http://segmentfault.com/q/1010000000173226







CMap与L1000技术解析:基因表达数据在药物发现中的应用 本文深入解析了CMap(连接图)与L1000技术在药物发现中的核心应用。CMap通过构建基因表达“关系网”,实现基于模式匹配的药物重定位;L1000技术则以低成本、高通量方式生成关键基因表达数据,支撑了LINCS超级数据库。文章以CLUE平台为例,手把手演示了如何利用疾病基因表达签名逆向筛选潜在治疗化合物,并拓展了其在解析药物机制、预测副作用等多场景下的价值。 阅读详情

相关推荐

湿敏电阻HR202的两种驱动方案实测:IO充放电法 vs. 交流方波ADC法,哪个更适合你?

本文深入评测湿敏电阻HR202的两种驱动方案:IO充放电法和交流方波ADC法。通过原理图分析、精度实测和资源占用对比,揭示交流方波ADC法在精度和稳定性上的优势,特别适合长期监测场景。同时提供IO充放电法在资源受限情况下的应用建议,帮助工程师根据项目需求做出最优选择。

weixin_30421809的博客 466

ngReact - React 组件与 AngularJS 的无缝集成指南

--- ## 项目介绍 **ngReact** 是一个轻量级的解决方案,它使得在 AngularJS 应用中直接使用 React 组件成为可能。这个库桥接了两个前端巨头的世界,允许开发者利用 React 的高性能组件化特性,同时保持 AngularJS 的数据绑定和依赖注入优势。对于那些希望将现有 AngularJS 项目逐步迁移到 React 或者仅仅是想在 Angular 环境中体验 Re...

gitblog_00826的博客 1091

【车辆仿真】从0开始建立dSPACE RT Simulink工程:CAN通信(RTICANMM方法)

【工程环境信息】:本文基于链接文章搭建SCALEXIO Rack RTPC总线节点,用于与AutoBox通信硬件:上位机:惠普台式PC(Windows 11专业版)下位机(实时机):AutoBox (DS1006)板卡:DS6342软件:本文所使用的DBC链接提示:以下是本篇文章正文内容,下面案例可供参考!!!的部分一定记得配置,其他的按需配置RTICANMM的灵活度非常高,尽可能参考Help文档,理解相应的配置内容官方有RTICANMM的样例工程,在下方路径。

winnizap的博客 2381

在react项目中集成angularJS

注:Demo源码地址:https://github.com/smk108/react-angular   React和Angular都是主流的前端框架,我参与的前端项目通常都是使用react开发,因为要在自己开发的项目中使用一个由angular开发的开源项目,因此开始尝试两大主流框架的集成。   React文档中讲到了react可以与第三方库整合,是以jQuery 和Backbone为例讲...

smk108的博客 2753

四十二、Fluent欧拉模型流化床模拟:从基础设置到颗粒动力学解析

本文详细解析了Fluent欧拉模型在流化床模拟中的应用,从基础概念到颗粒动力学设置全面覆盖。重点介绍了欧拉模型的颗粒温度概念、多相流配置技巧以及关键参数优化策略,帮助工程师准确模拟气固两相流动现象。通过实用案例演示了网格检查、求解器配置和边界条件设置的最佳实践。

weixin_27303545的博客 444

【无标题】 Python自动化法律文书撰写

Jinja2是一个功能强大的模板引擎,支持丰富的语法和功能。除了条件判断和循环语句外,Jinja2还支持过滤器、宏、继承等高级特性,非常适合处理复杂的文书模板。

master_chenchen的博客 2062

推荐项目:AngularJS与ReactJS的完美融合 —— angular-react

推荐项目:AngularJS与ReactJS的完美融合 —— angular-react 在现代前端开发中,寻求高效、灵活的技术解决方案一直是开发者们的追求。今天要向大家隆重推荐的开源项目——angular-react,正是这样一座连接两大前端巨头AngularJS和ReactJS的桥梁。该项目巧妙地将AngularJS的丰富功能与ReactJS的高性能视图渲染能力融为一体,为复杂Web应用提供了...

gitblog_00261的博客 1778

自定义LayoutManager实现android-pile-layout滑动卡片堆叠效果

这是我的第一篇博客,总算有个契机开始写博客了,就从自定义LayoutManager开始吧。 前段时间看到一个项目(android-pile-layout),效果特别不错,这是效果图: 效果确实不错,我看了下实现,是用的自定义的ViewGroup实现的,计算什么还搞的挺复杂的,具体的没细看。作者说也尝试过用LayoutManager实现,但是没找到合适的数学模型,好吧,看到数学模型我

u014296305的博客 1万+

10个alp高级技巧:解锁日志过滤、数据导出与实时监控的秘密

alp(Access Log Profiler)是一款强大的日志分析工具,能够帮助开发者和运维人员快速解析、过滤和分析访问日志数据。本文将分享10个alp高级技巧,助你轻松掌握日志过滤、数据导出与实时监控的核心功能,提升日志分析效率。 ## 1. 使用--filters精准过滤日志内容 🚀 alp提供了强大的`--filters`选项,让你可以根据多种条件筛选日志数据。无论是URL路径、请求

gitblog_00095的博客 444

从零到一:Cadence AC仿真中的运放性能参数深度解析与实战避坑指南

本文深度解析Cadence AC仿真中运放性能参数的精确测量方法,包括开环增益、带宽和相位裕度等关键指标。通过实战案例分享常见设置错误的避坑技巧,帮助工程师提升设计成功率和仿真效率,特别针对全差分运放和工艺角分析提供专业指导。

www00的博客 290

一个响应ping包延迟偏大的问题

前段时间客户反馈一个使用pc上的命令行ping无线设备(WiFi4)时,设备平均响应时间(测试时长2小时,1秒Ping一次)相比其它机型偏慢的问题,并上传上具体的时间的Log.从log中看到,大多数包的响应还是比较快的,只是个别响应时间较长,且响应时间长的包时间几乎都是一样的100多ms.如下是部分响应时间截图. 整个2小时的测试时间里,总是时不时的出这么上102,104ms的响应时间,这直接导致了平均响应时间被拉大.于是本地测试,也发现了类似的延迟.本地测试时,现象略有...

流风回雪的博客 1万+

前端单页开发框架学习资料总结

为什么80%的码农都做不了架构师?>>> ...

weixin_34247299的博客 116

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

Angular入门到精通系列教程(1) - Angular,Vue,React 选型

1. 概述 总的来说一句话,如果你是老大,你可以选择用什么;如果你不是,那么,老大让用什么,你就用什么。 前端框架Angular,Vue,React三选一,没有第四种。 (当然,如果只是一两个简单的页面,纯JS、jquery足够了)。 国内的话,React和vue更流行一点,国外的话React和Angular更流行。 Vue 中文资料更多一些 Angular有些资源访问受限或者较慢(防火墙问题) 2. 框架比较 网上比较的文章太多了,如果想了解,baidu、google一下吧,这个就不再多说了。 3.

Jack @ 优快云 6453

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

Vue前端框架选型论述

Vue前端框架选型论述 1. 前端3大巨头框架综述 React 起源于 Facebook 的内部项目,社区非常活跃,下载使用当前排行第一名,但是 React 的只能是半开源,在不涉及到 Facebook 子公司或者 Facebook 合作公司利益的条件下开源,否则属于专利侵权。React 框架相对于 Vue 要复杂的多,学习成本高于Vue。 AngularJS 诞生于2009年,由Misk...

秋枫落落的博客 1547

Java方向学习规划

学习预方向 Java后端开发 Java SE 数据库 JAVA EE(学习此部分前请先完成Web前端的开发学习) Web前端开发 HTML5 和 CSS JavaScript 和 jquery vue.js 和 node.js angularJS,ReactJS Bootstrap

亦墨 的博客 180

前端面试宝典【vue】

1、vue.js的两大核心? 2、前端三大框架的对比? 3、Vue.js是什么? 4、Vue.js与其他框架的区别? 1、与AngularJS的区别 2、与React的区别

weixin_71000374的博客 266

前端网站资源精编!!

不要吝啬你的赞美喜欢就点个赞

python233的博客 9764

前端资源分享-只为更好前端

一、团队组织 网站 说明 腾讯 AlloyTeam 团队 腾讯Web前端团队,代表作品WebQQ,致力于前端技术的研究 ISUX 腾讯社交用户体验设计,简称ISUX,腾讯设计团队网站 CDC 腾讯用户研究与体验设计部 FEX 百度Web前端研发部出品 淘宝前端团队(FED) 用技术为体验提供无限可能 凹凸实验室 京东用户体验设计部...

javajavajava 693

思考 ”前端开发人员都在关注的 GitHub 资源“

点这里 原文: 资源 免费的计算机编程类中文书籍 免费编程书籍 计算机科学论文 codeparksharePython初学者书籍、视频、资料、社区推荐 Python资料汇总 app应用推荐 码农周刊整理 500 Lines or Less一些不错的代码 前端 node.js中文资料导航 了不起的NodejsNodejs的各种资源 AngularJS-L...

weixin_30546933的博客 102

最新爱前端课程全套(初级+中级+高级)

【课程内容】 1.初级 1.HTML 2.CSS 3.JS基础 2.中级 1.jQuery 2.JS进阶-特效 3.JS进阶-对象 4.PHP与数据库 5.服务器与Ajax 6.HTML5 7.CSS3 8.移动端 9.Bootstrap 3.高级 1.Canvas动画和手机游戏 2.NodeJS入门和企业级项目 3.AngularJS入门和企业级项目 4.ES6-Babel-Webpack-...

qq19911012的博客 621

目前流行的前端框架Vue、AngularJS、React的优点和缺点

学习web前端开发中,会有很多的框架,那么目前流行的框架有哪些呢?一、Vue.js:     其实Vue.js不是一个框架,因为它只聚焦视图层,是一个构建数据驱动的Web界面的库。     Vue.js通过简单的API(应用程序编程接口)提供高效的数据绑定和灵活的组件系统。     Vue.js的特性如下:      1.轻量级的框架      2.双向数据绑定      3.指令      4....

WP8HUB 4158

前端学习网站

前端知识学习网址汇总 HTML5学习网站 W3C http://www.w3school.com.cn/html5/ W3C https://www.w3.org/html/ig/zh/wiki/HTML5 菜鸟教程 http://www.runoob.com/html/html5-intro.html HTML5中文门户 http://www.html5cn.org/ css3学习网站 W3C CSS教程 http://www.w3school.com.cn/css/index.asp W3C CSS3教

qq_41613768的博客 643

AngularJS 和 React区别

AngularJS 和 React 是两个目前最为流行的前端框架之一。它们有一些共同点,例如都是基于 JavaScript 的开源框架,都能够帮助开发者构建复杂的单页面应用程序等。

AI时代光年 1876

AngularJs与ReactJS优缺点&适用场景

Angular的优缺点: 优点 AngularJS是一套完整的框架,angular有自带的数据绑定、render渲染、angularUI库,过滤器,directive(模板),服务q(defer),http,inject(依赖注入),factory,provider……,等等一系列工具,基本上只要你在做web开发用过的东西,它都有一个。但是这些东西react自身都没有。

u012125579的专栏 1万+

AngularJS、ReactJS与VueJS比较 - DZone

对于一个优秀的开发人员来说,任何框架几乎没有任何实质性的区别。他们对这些技术中的任何一种都感到满意,但对于企业而言,它会产生不同。这取决于他们到底想要什么: 您想开发一个对 SEO 友好的网站吗?如果是,React JS 是正确的技术。 您想要一个具有优化安全性的网站吗?如果是,请相信 AngularJS。 您想开发一个轻量级的 Web 应用程序吗?如果是,则使用 Vue JS。 您想在更短的时间内完成 Web 开发过程吗?如果是,Angular 是正确的选择。 ...

极道Jdon的技术博客 703
上一篇: Java Checked 和 UnChecked Exception 的区别
下一篇: Code School Try Git git互动教程
chiiis
博客等级 码龄14年 422粉丝 429原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值