是最新react用的算法选择,其大概的介绍点击这里;react
在现有React中,更新过程当中是同步的(这个js代码的代码执行相关)git
In order to do any of this, we first need a way to break work down into units. In one sense, that's what a fiber is. A fiber represents a unit of work.github
That's the purpose of React Fiber. Fiber is reimplementation of the stack, specialized for React components. You can think of a single fiber as a virtual stack frame.算法
In concrete terms, a fiber is a JavaScript object that contains information about a component, its input, and its output.redux
破解JavaScript中同步操做时间过长的方法其实很简单——分片。 数据结构
React Fiber把更新过程碎片化,每执行完一个更新过程,将控制权交给react,它会根据优先级安排下一次的任务; dom
维护每个分片的数据结构,就是Fiber。异步
参考文件函数
在现有的React中,每一个生命周期函数在一个加载或者更新过程当中绝对只会被调用一次;在React Fiber中,再也不是这样了,第一阶段中的生命周期函数在一次加载和更新过程当中可能会被屡次调用!ui
这些在react fiber中可能执行屡次
这些只能执行一次
fiber新的调度系统,setState都是异步的,因此:
错误的姿式
this.setState({ a: this.state.a + this.props.b });
正确的姿式
this.setState((a, b) => ({ a: prevState.a + props.b }))
欢迎来github上 start