Skip to content

Instantly share code, notes, and snippets.

@dance2die
Last active August 13, 2018 14:35
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/478cd39c072ae76ef774c63efc9735b5 to your computer and use it in GitHub Desktop.
Save dance2die/478cd39c072ae76ef774c63efc9735b5 to your computer and use it in GitHub Desktop.
throttledWindowHandler = throttle(
this.windowSizeHandler,
debounceWaitTime,
debounceOptions
);
async componentDidMount() {
window.addEventListener("scroll", this.throttledWindowHandler);
window.addEventListener("resize", this.throttledWindowHandler);
const { posts } = this.state;
if (!posts || posts.length <= 0) {
await this.getNextPosts();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment