joshwnj / joshwnj/react-visibility-sensor

findDOMNode will be deprecated

Open
#141 21 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.3k
Forks
192
PR merge metrics
No merged PRs in 30d

Description

Starting from React 16.6 it is deprecated in StrictMode and it will be deprecated from React in the future. [Here](https://reactjs.org/docs/strict-mode.html#warning-about-deprecated-finddomnode-usage) is some more information about this.

The docs state the following:
> Normally you don’t need this because you can attach a ref directly to a DOM node.

However, reading through the source code I see that VisibilitySensor is not rendering any DOM nodes itself, so I'm not sure what would be the best way to attach the ref.

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.