Observe React component visibility in the viewport or visibility relative to an ancestor.
$ npm install observe-visibility
$ yarn add observe-visibility
Example:
<ObserveVisibility>
{({ isVisible }) => {
isVisible && doSomething();
return <Placeholder />;
}}
</ObserveVisibility>
If you are interested in contributing, please submit a pull request.