Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warnings with React StrictMode #45

Open
aduth opened this issue Jan 7, 2019 · 1 comment
Open

Warnings with React StrictMode #45

aduth opened this issue Jan 7, 2019 · 1 comment

Comments

@aduth
Copy link

aduth commented Jan 7, 2019

react-click-outside's use of findDOMNode triggers a warning when used with React.StrictMode.

https://reactjs.org/docs/strict-mode.html

Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of PopoverDetectOutside which is inside StrictMode. Instead, add a ref directly to the element you want to reference.

("PopoverDetectOutside" is the component wrapped using react-click-outside)

Specific issue:

https://reactjs.org/docs/strict-mode.html#warning-about-deprecated-finddomnode-usage

Looking at the implementation, would it be possible to assign the ref as the result of a createRef, calling the wrappedRef callback during componentDidMount using this.ref.current?

https://reactjs.org/docs/refs-and-the-dom.html

@kentor
Copy link
Owner

kentor commented Jan 22, 2019

that's not gonna work facebook/react#14357. will need react team to implement a workaround

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants