react 沉思录
react = Virtual DOM + component + data flow + jsx
核心是Virtual DOM结构的状态维护、渲染机制及UI系统的DOM组织功能;
基于Virtual DOM的视图构建和渲染方式。
入口为index.html;
一、虚拟DOM
基于状态管理的UI组件化技术
at its core it’s made up of functional components, with clear direction on how to manage state properly.
- Frequent DOM manipulations are expensive and performance heavy.
- Virtual DOM is a virtual representation of the real DOM.
- When state changes occur, the virtual DOM is updated and the previous and current version of virtual DOM is compared. This is called “diffing”.
- The virtual DOM then sends a batch update to the real DOM to update the UI.
- React uses virtual DOM to enhance its performance.
- It uses the observable to detect state and prop changes.
- React uses an efficient diff algorithm to compare the versions of virtual DOM.
- It then makes sure that batched updates are sent to the real DOM for repainting or re-rendering of the UI.
https://www.cnblogs.com/feng9exe/p/11084600.html
二、component
status/propts
生命周期管理;
状态管理;
渲染:
const element = <h1>Hello, world</h1>;
.(,.());
事件;
三、jsx
React发明了JSX,利用HTML语法来创建虚拟DOM。
当遇到<,JSX就当HTML解析,遇到{就当JavaScript解析。
render() {
return React.createElement(
"div",
null,
"Hello ",
this.props.name
);
}
render() {
return (
<div>
Hello {this.props.name}
</div>
);
}
四、架构模式—MVC模式
While React is the ‘V’ in the MVC structure, Flux fills in the ‘M’ and ‘C’ components.
ReactJS In the simple and popular term, React is the V (View) in MVC (Model/View/Controller).
五、数据流
- When state changes occur, the virtual DOM is updated and the previous and current version of virtual DOM is compared. This is called “diffing”.
- The virtual DOM then sends a batch update to the real DOM to update the UI.
- Last but not the least, React utilizes unidirectional data flow, ensuring a clean data flow architecture throughout your application. This focused flow allows developers to have a better control over the functions.
六、依赖库管理
package
node install x
react 沉思录的更多相关文章
- 【C++沉思录】句柄2
1.[C++沉思录]句柄1 存在问题: 句柄为了绑定到Point的对象上,必须定义一个辅助类UPoint,如果要求句柄绑定到Point的子类上,那就存在问题了.2.有没有更简单的办法呢? 句柄使用Po ...
- 【C++沉思录】句柄1
1.在[C++沉思录]代理类中,使用了代理类,存在问题: a.代理复制,每次创建一个副本,这个开销有可能很大 b.有些对象不能轻易创建副本,比如文件2.怎么解决这个问题? 使用引用计数句柄,对动态资源 ...
- 生活沉思录 via 哲理小故事(四)
1.围墙里的墓碑 第一次世界大战期间,驻守意大利某小镇的年轻军官结识了镇上的牧师.虽然军官信仰信教,而牧师是天主教牧师,但两人一见如故. 军官在一次执行任务中身负重伤,弥留之际嘱托牧师无论如何要把自己 ...
- 生活沉思录 via 哲理小故事
本文转载:http://www.cnblogs.com/willick/p/3174803.html 1.小托蒂的悲剧 意大利小男孩托蒂,有一只十分奇怪的眼睛,因为从生理上看,这是一只完全正常的眼睛, ...
- 生活沉思录 via 哲理小故事(一)
1.小托蒂的悲剧 意大利小男孩托蒂,有一只十分奇怪的眼睛,因为从生理上看,这是一只完全正常的眼睛,但却是失明的. 原来,托蒂刚出生时,这只眼睛轻度感染,曾用绷带缠了两个星期.这对常人来说几乎没有人任何 ...
- Atitit。 沉思录 与it软件开发管理中的总结 读后感
Atitit. 沉思录 与it软件开发管理中的总结 读后感 1. <沉思录>,古罗马唯一一位哲学家皇帝马可·奥勒留所著 2 2. 沉思录与it软件开发管理中的总结 2 2.1. 要有自己的 ...
- react hooks沉思录
将UI组件抽象为状态处理机.分为普通状态和副作用状态. 一.综述 useState:处理函数只改变引用的状态本身:副作用状态:会对引用状态以外的状态和变量进行修改:useReducer:用解藕化的机制 ...
- redux沉思录
要素:store.reducer.dispatch/subscribe connect:将业务逻辑剥离到容器类,数据的双向绑定: 数据.操作.UI分离.命令封装 核心思想:对共享状态的维护: 核心代码 ...
- flux沉思录:面向store和通信机制的前端框架
一.综述 Flux 被用来描述“单向”的数据流,且包含某些特殊的事件和监听器. 响应式编程是一种面向数据流和变化传播的编程范式 flux是响应式编程的一种? Flux 在本质上采用了模型-视图-控制器 ...
随机推荐
- Buttons按扭
到目前为此,我们已经写了一些程序代码,但都只是输出,然而,有时我们也希望板子能处理一些输入,输入输出我们都是针对板子来说的.microbit板子上的两个按键是最显眼的输入,分别是A和B,mPython ...
- Kafka部署篇
目录 安装 下载与安装 配置 启停操作 验证 基本操作 创建topic 列出现有的topic 查看topic的详细信息 增加topic的partition数量 修改一个topic的副本数 删除一个to ...
- 模拟 + 打表 --- Emag eht htiw Em Pleh
Emag eht htiw Em Pleh Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2578 Accepted: ...
- 从零开始学C语言
从零开始学C语言 @阆苑祁寒 更新时间:2019-09-13 写在前面:本文从一个初学者的角度,给出了对C语言的简单理解.如有谬误,敬请指出! Week1——基本语法 #include <std ...
- Marshmallow详解
目录 Marshmallow详解 1. Scheme 2. Serializing(序列化) 3. 过滤输出 4. Deserializing(反序列化) 5. 处理多个对象的集合 6. Valida ...
- K8S学习笔记之K8S日志搜集实战
详细参考这篇文章,几乎覆盖了了K8S的各种日志搜集方案 https://juejin.im/post/5b6eaef96fb9a04fa25a0d37#heading-8
- Smobiler客户端会话
//客户端会话存值 Client.Session["userid"] = Class1.userid; //客户端会话取值 userid = Client.Session[&quo ...
- Django--模型层进阶
目录 QuerySet对象 可切片 可迭代 惰性查询 缓存机制 何时查询集不会被缓存? exists()与iterator()方法 exists() iterator() 中介模型 查询优化 表数据 ...
- JavaScript 之 navigator 对象
navigator 对象可以查看用户所使用的浏览器类型和系统平台类型. 1.userAgent 通过 userAgent 可以判断用户浏览器的类型. Chrome 浏览器效果: 2.platform ...
- 单词diamaund钻石diamaund英文
Diamond Di"a*mond (?; 277), n. [OE. diamaund, the hardest iron, steel, diamond, Gr. . Perh. the ...