如何在 React 16 中找到导致更新的触发器?

use*_*582 5 debugging reactjs

我最近升级到光纤。15、当一个组件更新时,更新堆栈跟踪如下所示

component1Update
...react framework stuff
  component2Update
  ...react framework stuff
    component3Update
    setState
    onClick() <-- Aha!
Run Code Online (Sandbox Code Playgroud)

你如何在 Fiber (React 16) 中找到更新的起源?

Luk*_*aic 4

我建议查找在react-profiler中不断更新的节点,然后用https://github.com/welldone-software/why-did-you-render装饰该组件,这应该告诉你为什么它更新。