flowtip icon indicating copy to clipboard operation
flowtip copied to clipboard

Remove dependency on ReactDOM.findDOMNode

Open 10xjs opened this issue 6 years ago • 0 comments

findDOMNode is slated for deprecation soon, and support in React 16 appears to be partially dropped already.

We currently rely on a custom findDOMNode function that will safely attempt to detect the rendered node using react fiber internals when necessary. This universally supports React 16 and earlier versions.

This isn't the best long-term solution since it relies on undocumented internals.

Dan recomments passing a ref handler prop down throug the component tree: https://github.com/yannickcr/eslint-plugin-react/issues/678.

I'm not completely sold on this approach as it would complicate the consumer-facing interface. The provided content handler would need to manually pass a contentRef prop to its outermost element. Although this isn't too different from how the style prop is used.

Looking for ideas.

10xjs avatar Mar 15 '18 05:03 10xjs