Skip to content

Instantly share code, notes, and snippets.

@dance2die
Last active August 10, 2018 02:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dance2die/7737098b139ab2607952530f70584864 to your computer and use it in GitHub Desktop.
Save dance2die/7737098b139ab2607952530f70584864 to your computer and use it in GitHub Desktop.
const heightOffset = 1500;
...
windowSizeHandler = e => {
const isBottomReached =
window.scrollY + window.innerHeight + heightOffset >=
document.body.offsetHeight;
this.setState({ isBottomReached }, async () => {
if (isBottomReached) await this.getNextPosts();
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment