Skip to content

Instantly share code, notes, and snippets.

@agoiabel
Created March 6, 2019 11:13
Show Gist options
  • Save agoiabel/da4b824dc6f17fc72b24eab8bdff51a5 to your computer and use it in GitHub Desktop.
Save agoiabel/da4b824dc6f17fc72b24eab8bdff51a5 to your computer and use it in GitHub Desktop.
renderPageNumbers = pageNumbers.map(number => {
let classes = this.state.current_page === number ? styles.active : '';
if (number == 1 || number == this.state.total || (number >= this.state.current_page - 2 && number <= this.state.current_page + 2)) {
return (
<span key={number} className={classes} onClick={() => this.makeHttpRequestWithPage(number)}>{number}</span>
);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment