Pomax / react-onclickoutside

An onClickOutside wrapper for React components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The use of findDOMNode is deprecated in React Strict Mode

arqex opened this issue · comments

Hey! First thanks for this great library I've been using for so long.

It is used also inside of react-datetime and I got an issue from a user complaining about using reactDom.findDOMNode. Looks that it's going to be deprecated and we should move away from it.

Any alternative for removing it?

Cheers

commented

Does the warning tell you what should be used instead, by any chance?

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

This fix is pertinent because strict mode is required for upcoming React features such as Concurrent Mode, thus this will not work properly unless it is refactored.

commented

given how this HOC works, refs are a problem until it's uplifted to use forwardRefs, so it might keep throwing warnings until we can get to updating it with those =(

(but if you want to take a stab at it, that'd be aweseme!)

The main issue as I posted above, is that warnings now will become errors when this is used with upcoming react features.

commented

But React follows proper semver, and do not release minor versions that are backward incompatible. Those warnings will not turn into errors until React 17, at which point v6 of this library will become incompatible (just like how v5 is incompatible with versions before v15).

I'm not saying this shouldn't get fixed, but I am saying that warnings are not errors, and this library will keep working with the main React component pattern just fine until that next major release comes out. So until then: if you want to take a stab at it, that's great, but I probably won't get to addressing this myself until I can find some time from my other engagements (or if someone pays me to make time and do this sooner, of course. I only have a finite amount of time, and quite a lot of projects).

commented

v6.9.0 published

Hello, I see that the issue is closed, but I still notice it with me even though I up react-onclickoutsideit to version 6.10.0

"Warning: findDOMNode is deprecated in StrictMode...."

commented

was that a typo, or are you actually using something called react-onclickoutsideit? (because that would be a different project, then)

Typo, sorry, what I'm using is "react-onclickoutside": "^6.10.0" exactly. And I still have the Warning "findDOMNode is deprecated in StrictMode..." when I wrapped onClickOutside in "React Strict Mode"

commented

Then you'll want to file a new issue, since this one got closed, with a minimum reproducible example so the problem's essentially reproducible with a copy paste. Thanks!

I see no newer issue. Was this resolved?

commented

I didn't see a new issue filed, so not yet