re: A super simple implementation of Infinite Scrolling VIEW POST

re: Nice work! Have you seen the IntersectionObserver API? It might allow you to simplify this code even further 😁

Would strongly second checking out the IntersectionObserver API. Scroll handlers can come with a lot of performance bottlenecks (even if debounced) in execution that blocks the main thread (js is single threaded in nature), slowing everything else on the page .. you might see stuff work smoothly on a developer desktop but when you test on a low end device like an average phone (what your users may be using), you'll see frame drops and jank :( IOs provide async ways to solve problems like this and has been a great addition to the web! If you absolutely need to use scroll listeners, try exploring if "passive" scroll listeners will work for you.

code of conduct - report abuse