Infinite Scrolling With React with React-virtualized

  useEffect(() => {
function onScroll() {
console.log(
window.scrollY,
document.documentElement.clientHeight,
document.documentElement.scrollHeight
);
}

window.addEventListener("scroll", onScroll);
return () => {
window.removeEventListener("scroll", onScroll);
};
}, []);
yarn add react-virtualized
  • Code before optimisation : 223.28ms
  • Code after react-virtualized : 61.42ms
  • Fixed value for height and width. If you need to handle this, use “CellMeasurer” component that calculate height
  • Scroll chaining

--

--

Investor & Software Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store