We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A JavaScript library for building user interfaces
class Hello extends React.Component { render() { return ( <div> Hello {this.props.name} </div> ); } }
const Hello = (props) => <div>Hello{props.name}</div>
return React.createElement('div', {className: 'shopping-list'}, React.createElement('h1', /* ... h1 children ... */), React.createElement('ul', /* ... ul children ... */) );
<Component onClick={this.handleClick}/>
target.addEventListener(type, listener[, options]); target.attachEvent(eventNameWithOn, callback)
EventPluginHub
<pre> * wrappers (injected at creation time) * + + * | | * +-----------------|--------|--------------+ * | v | | * | +---------------+ | | * | +--| wrapper1 |---|----+ | * | | +---------------+ v | | * | | +-------------+ | | * | | +----| wrapper2 |--------+ | * | | | +-------------+ | | | * | | | | | | * | v v v v | wrapper * | +---+ +---+ +---------+ +---+ +---+ | invariants * perform(anyMethod) | | | | | | | | | | | | maintained * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|--------> * | | | | | | | | | | | | * | | | | | | | | | | | | * | | | | | | | | | | | | * | +---+ +---+ +---------+ +---+ +---+ | * | initialize close | * +-----------------------------------------+ * </pre>
####批更新
html:
<ul id='list'> <li class='item'>Item 1</li> <li class='item'>Item 2</li> <li class='item'>Item 3</li> </ul>
DOM对象
var element = { tagName: 'ul', // 节点标签名 props: { // DOM的属性,用一个对象存储键值对 id: 'list' }, children: [ // 该节点的子节点 { tagName: 'li', props: {class: 'item'}, children: ["Item 1"] }, { tagName: 'li', props: {class: 'item'}, children: ["Item 2"] }, { tagName: 'li', props: {class: 'item'}, children: ["Item 3"] }, ] }
深度优先,层级对比:
// 一个Fiber对象作用于一个组件 export type Fiber = {| // 标记fiber类型tag. ag: TypeOfWork, // fiber对应的function/class/module类型组件名. type: any, // fiber所在组件树的根组件FiberRoot对象 stateNode: any, // 返回当前fiber所在fiber树的父级fiber实例 return: Fiber | null, // fiber树结构相关链接 child: Fiber | null, sibling: Fiber | null, index: number, ... |};
将虚拟DOM转换为Fiber节点,首先它规定一个时间段内,然后在这个时间段能转换多少个FiberNode,就更新多少个。可以中断DOM的渲染,去渲染优先级更高的DOM树。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
react
JSX
组件挂载
事件系统
事件系统
事务
####批更新
虚拟dom
html:
DOM对象
diff
深度优先,层级对比:
Fiber
异步渲染
将虚拟DOM转换为Fiber节点,首先它规定一个时间段内,然后在这个时间段能转换多少个FiberNode,就更新多少个。可以中断DOM的渲染,去渲染优先级更高的DOM树。
新生命周期
The text was updated successfully, but these errors were encountered: