4 ms·
> scroll position is typically not tracked in the React state, so how does it work? The typical approach would be to attach an event listener to a scroll event
by TheCoelacanth 4y ago
> scroll position is typically not tracked in the React state, so how does it work?
The typical approach would be to attach an event listener to a scroll event or to an IntersectionObserver and then set a state property from that.
Memoization is supposed to be purely a performance enhancement. I would never use it for handling scroll position.