I was trying to make a count up using react visibility sensor and react count up, but when I tried to set it up an error shows in the console. Is there a proper way to solve?
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.
My code is
<div className="App">
<VisibilitySensor partialVisibility offset={{ bottom: 200 }}>
{({ isVisible }) => (
<div style={{ height: 100 }}>
{isVisible ? <CountUp duration={5} start={0} end={1000} /> : null}
</div>
)}
</VisibilitySensor>
</div>
There is an open issue on the react-visibility-sensor repo, but the whole project seems to be not maintained any longer (last commit was in 2019).
I'm not a user of the plugin, but some people suggest moving to react-intersection-observer as an alternative.