I'm using react-countup plugin to animate a counter from 0 to identified number and i wanted to make this counter works only once on scroll when it's revealed first time.. and I used this code using react visibility censor
<CountUp start={0} end={4.8} duration={2} decimals={1}>
{({ countUpRef, start }) => (
<VisibilitySensor onChange={start}>
<span ref={countUpRef} />
</VisibilitySensor>
)}
</CountUp>
but then it's happening every time it's revealed in the page and i want it to happen only the first time