20200926

Slate Data View Lazy Loading Demo

Implemented lazy loading today for the Slate Data View. I still spend most of my time understanding code more than writing code form scratch. By I love seeing patterns in how others write, to that I can write better code my self too.

  state = {
menu: null,
loading: {},
startIndex: 0,
checked: {},
view: "grid",
viewLimit: 20,
};
  _handleScroll = (e) => {
const windowHeight =
"innerHeight" in window ? window.innerHeight : document.documentElement.offsetHeight;
const body = document.body;
const html = document.documentElement;
const docHeight = Math.max(
body.scrollHeight,
body.offsetHeight,
html.clientHeight,
html.scrollHeight,
html.offsetHeight
);
const windowBottom = windowHeight + window.pageYOffset;
if (windowBottom >= docHeight) {
this.setState({ viewLimit: this.state.viewLimit + 20 });
} else {
}
};