Is it possible to retrieve a component's instance from a React Fiber?
问题 Before v16 of React -- that is, before the introduction of React fibers -- it was possible to take a DOM element and retrieve the React component instance as follows: const getReactComponent = dom => { let found = false; const keys = Object.keys(dom); keys.forEach(key => { if (key.startsWith('__reactInternalInstance$')) { const compInternals = dom[key]._currentElement; const compWrapper = compInternals._owner; const comp = compWrapper._instance; found = comp; } }); return found || null; };