国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

淺談ReactFiber

yibinnn / 2054人閱讀

摘要:什么是每一個(gè)都有一個(gè)對(duì)應(yīng)的,記錄這個(gè)節(jié)點(diǎn)的各種狀態(tài),是一鏈表的結(jié)構(gòu)的串聯(lián)起來(lái)。

1. 什么是fiber

每一個(gè)ReactElement都有一個(gè)對(duì)應(yīng)的fiber, 記錄這個(gè)節(jié)點(diǎn)的各種狀態(tài), fiber是一鏈表的結(jié)構(gòu)的串聯(lián)起來(lái)。

2. Fiber的組成
export type Fiber = {|
 
          // Tag identifying the type of fiber.
        //區(qū)分fiber的種類
  tag: WorkTag,

          // Unique identifier of this child.
        // 像react元素中的唯一的key
  key: null | string,

          // The value of element.type which is used to preserve the identity during
          // reconciliation of this child.
            //就是creatElement的第一個(gè)值,用來(lái)在子節(jié)點(diǎn)reconciliation階段的標(biāo)識(shí)
  elementType: any,

          // The resolved function/class/ associated with this fiber.
        //異步組件加載resovled后種類是函數(shù)式還是類
  type: any,

          // The local state associated with this fiber.
        //與這個(gè)fiber聯(lián)系的本地狀態(tài),指向?qū)嵗?  stateNode: any,

          // It is conceptually the same as the return address of a stack frame.
         // 指向 Fiber Tree 中的父節(jié)點(diǎn)
  return: Fiber | null,

          // Singly Linked List Tree Structure.
         // 指向第一個(gè)子節(jié)點(diǎn)
  child: Fiber | null,
        // 指向兄弟節(jié)點(diǎn)
  sibling: Fiber | null,
  index: number,

  // The ref last used to attach this node.
  // I"ll avoid adding an owner field for prod and model that as functions.
  ref: null | (((handle: mixed) => void) & {_stringRef: ?string}) | RefObject,

          // Input is the data coming into process this fiber. Arguments. Props.
          //新的即將進(jìn)來(lái)的props
  pendingProps: any, // This type will be more specific once we overload the tag.
            // 現(xiàn)在的已經(jīng)展示在UI上的props
  memoizedProps: any, // The props used to create the output.
        
          // A queue of state updates and callbacks.
        // 保存更新的狀態(tài)和回調(diào)函數(shù)
  updateQueue: UpdateQueue | null,

      // The state used to create the output
      // 展示在UI中的state
  memoizedState: any,

  // A linked-list of contexts that this fiber depends on
  contextDependencies: ContextDependencyList | null,

  mode: TypeOfMode,

      // Effect
    //副作用
  effectTag: SideEffectTag,

          // Singly linked list fast path to the next fiber with side-effects.
        // 單鏈表結(jié)構(gòu),方便遍歷 Fiber Tree 上有副作用的節(jié)點(diǎn)
  nextEffect: Fiber | null,

  // The first and last fiber with side-effect within this subtree. This allows
  // us to reuse a slice of the linked list when we reuse the work done within
  // this fiber.
    //在子節(jié)點(diǎn)中的第一個(gè)和最后一個(gè)的副作用,這個(gè)可以允許我們進(jìn)行切片的復(fù)用
  firstEffect: Fiber | null,
  lastEffect: Fiber | null,

  // Represents a time in the future by which this work should be completed.
  // Does not include work found in its subtree.
  expirationTime: ExpirationTime,

  // This is used to quickly determine if a subtree has no pending changes.
  childExpirationTime: ExpirationTime,

  // This is a pooled version of a Fiber. Every fiber that gets updated will
  // eventually have a pair. There are cases when we can clean up pairs to save
  // memory if we need to.
  alternate: Fiber | null,

  // Time spent rendering this Fiber and its descendants for the current update.
  // This tells us how well the tree makes use of sCU for memoization.
  // It is reset to 0 each time we render and only updated when we don"t bailout.
  // This field is only set when the enableProfilerTimer flag is enabled.
  actualDuration?: number,

  // If the Fiber is currently active in the "render" phase,
  // This marks the time at which the work began.
  // This field is only set when the enableProfilerTimer flag is enabled.
  actualStartTime?: number,

  // Duration of the most recent render time for this Fiber.
  // This value is not updated when we bailout for memoization purposes.
  // This field is only set when the enableProfilerTimer flag is enabled.
  selfBaseDuration?: number,

  // Sum of base times for all descedents of this Fiber.
  // This value bubbles up during the "complete" phase.
  // This field is only set when the enableProfilerTimer flag is enabled.
  treeBaseDuration?: number,

  // Conceptual aliases
  // workInProgress : Fiber ->  alternate The alternate used for reuse happens
  // to be the same as work in progress.
  // __DEV__ only
  _debugID?: number,
  _debugSource?: Source | null,
  _debugOwner?: Fiber | null,
  _debugIsCurrentlyTiming?: boolean,

  // Used to verify that the order of hooks does not change between renders.
  _debugHookTypes?: Array | null,
|};

文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請(qǐng)注明本文地址:http://m.specialneedsforspecialkids.com/yun/103269.html

相關(guān)文章

  • 淺談React Fiber

    摘要:因?yàn)榘姹緦⒄嬲龔U棄這三生命周期到目前為止,的渲染機(jī)制遵循同步渲染首次渲染,更新時(shí)更新時(shí)卸載時(shí)期間每個(gè)周期函數(shù)各司其職,輸入輸出都是可預(yù)測(cè),一路下來(lái)很順暢。通過(guò)進(jìn)一步觀察可以發(fā)現(xiàn),預(yù)廢棄的三個(gè)生命周期函數(shù)都發(fā)生在虛擬的構(gòu)建期間,也就是之前。 showImg(https://segmentfault.com/img/bVbweoj?w=559&h=300); 背景 前段時(shí)間準(zhǔn)備前端招聘事項(xiàng)...

    izhuhaodev 評(píng)論0 收藏0
  • 淺談網(wǎng)站性能之前端性能優(yōu)化

    摘要:淺談網(wǎng)站性能之前端性能優(yōu)化性能優(yōu)化的目的無(wú)非是減少用戶流量消耗,提升用戶首屏體驗(yàn),提升用戶訪問速度,讓用戶專注內(nèi)容本身。前端性能優(yōu)化減少請(qǐng)求數(shù)量基本原理在瀏覽器與服務(wù)器進(jìn)行通信時(shí),主要是通過(guò)進(jìn)行通信。 最近項(xiàng)目慢慢走上正軌,需求趨于平穩(wěn),這才想起需要對(duì)整站進(jìn)行性能優(yōu)化。經(jīng)過(guò)一段時(shí)間的學(xué)習(xí),結(jié)合現(xiàn)在項(xiàng)目的實(shí)際性能情況,發(fā)現(xiàn)確實(shí)有許多地方可以進(jìn)行優(yōu)化。于是就開始了我的前端性能優(yōu)化之旅。以下...

    Winer 評(píng)論0 收藏0
  • 淺談網(wǎng)站性能之前端性能優(yōu)化

    摘要:淺談網(wǎng)站性能之前端性能優(yōu)化性能優(yōu)化的目的無(wú)非是減少用戶流量消耗,提升用戶首屏體驗(yàn),提升用戶訪問速度,讓用戶專注內(nèi)容本身。前端性能優(yōu)化減少請(qǐng)求數(shù)量基本原理在瀏覽器與服務(wù)器進(jìn)行通信時(shí),主要是通過(guò)進(jìn)行通信。 最近項(xiàng)目慢慢走上正軌,需求趨于平穩(wěn),這才想起需要對(duì)整站進(jìn)行性能優(yōu)化。經(jīng)過(guò)一段時(shí)間的學(xué)習(xí),結(jié)合現(xiàn)在項(xiàng)目的實(shí)際性能情況,發(fā)現(xiàn)確實(shí)有許多地方可以進(jìn)行優(yōu)化。于是就開始了我的前端性能優(yōu)化之旅。以下...

    philadelphia 評(píng)論0 收藏0
  • 淺談ThinkPHP 5.0

    摘要:杰出的數(shù)據(jù)庫(kù)遷移工具和緊密集成的單元測(cè)試支持,這些工具賦予你構(gòu)建任何應(yīng)用的能力。淺談應(yīng)公司要求,現(xiàn)在用重新搭一個(gè)框架,接觸了幾天對(duì)它也有了一定的了解。淺談支持,支持單元測(cè)試。更加嚴(yán)謹(jǐn)了,異常嚴(yán)謹(jǐn)?shù)腻e(cuò)誤檢測(cè)和安全機(jī)制。 自從接觸php開始,用的就是thinkphp框架,它給我的感覺是輕量,且容易上手。后來(lái)進(jìn)了一家外包公司又用了laravel框架,個(gè)人覺得laravel還是很高大上的,功能...

    mtunique 評(píng)論0 收藏0
  • 淺談前端優(yōu)化的幾個(gè)思路

    摘要:淺談前端優(yōu)化的幾個(gè)思路雪碧圖頁(yè)面中如果有很多圖片小圖標(biāo)這樣會(huì)有很多請(qǐng)求一個(gè)圖就是一個(gè)請(qǐng)求建立連接進(jìn)行三次握手這些都是耗費(fèi)時(shí)間的如果頁(yè)面很多可以考慮用精靈汽水雪碧也是這個(gè)單詞技術(shù)做一張雪碧圖將請(qǐng)求多個(gè)變成一次請(qǐng)求可以用來(lái)配置實(shí)現(xiàn)懶加載如果頁(yè)面 淺談前端優(yōu)化的幾個(gè)思路 https://ltoddy.github.io 雪碧圖 頁(yè)面中如果有很多圖片、icon(小圖標(biāo)),這樣會(huì)有很多HTTP請(qǐng)...

    heartFollower 評(píng)論0 收藏0

發(fā)表評(píng)論

0條評(píng)論

最新活動(dòng)
閱讀需要支付1元查看
<