Fork me on GitHub

i need to choose whether to render a component based on the position of the visible area in a scroll region - how have people achieved this ? processing scroll events to only produce a re-frame event when scrolling stops/pauses for a period seems like one possibility (previously we've had problems with the frequency of scroll events killing performance on mobile devices if turned directly into re-frame events). are there any others i'm missing ?


@mccraigmccraig you could debounce the firing of those events to limit the perf problem


At my work we did it by making a higher-order-component where the tooltips render function gets the tooltipee's DOM element as an argument to it's render function. It can then do measurements to decide its position. This also requires listening to window-size (debounced for perf)

👍 8