Fix findDOMNode deprecation warning#160
Conversation
This PR fixes React `findDOMNode` deprecation warning. https://reactjs.org/docs/strict-mode.html#warning-about-deprecated-finddomnode-usage This makes sure the component is compatible with upcoming concurrent mode. It's a breaking change and requires a major release because it adds a node to the DOM, we could use `display: contents;` as suggested by React.
|
Hi @sergio-toro thanks for this PR. It all looks good except there seems to be a breaking change related to the
This may be due to a quirk of the example itself, and I'm actually thinking about deprecating this form of passing a child component, and making the "child function" approach the only supported option, as that would simplify some things. But please take a look and see if you can see a way to fix it. From what I can see, it might be caused by the extra |
|
Hey @joshwnj, thank you for taking time to review the PR! If we want to stay compliant with concurrent mode the only way is to add the extra node, I tried to avoid it but haven't found any other way, even react team suggests this approach in order to fix Did you found issues running the example? Will take a look. |
|
Hi @sergio-toro, I believe I've found the reason why the example was failing: because the example uses an absolutely positioned element, when we wrapped it with a I've got a solution for this ready for you to review, could you please grant me access to make changes to this PR? https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork |
The maintainers check is already enabled in this PR, you should be able to add commits to it! |
- added getRef so consumers can specify which element is used for calculations - necessary for absolutely positioned elements in a container - added deprecation notice for passing elements as children - added some new test cases - updated README and examples
|
@sergio-toro ah cool, thanks! I've pushed the changes, please take a look and let me know if you think it's ready to merge 👍 |
I'm wondering if we should include the I got an idea for it, will do a separate PR with a proposal for a |
|
It would be great if this is merged and the warning is gone, what's the status? |
|
Any updates on that? |
|
@joshwnj please |
This PR fixes React
findDOMNodedeprecation warning.https://reactjs.org/docs/strict-mode.html#warning-about-deprecated-finddomnode-usage
This makes sure the component is compatible with upcoming concurrent mode.
It's a breaking change and requires a major release because it adds a node to the DOM, we could use
display: contents;as suggested by React.