Load props es mejor al inicio de render

This commit is contained in:
Daniel Cortes
2020-06-03 21:29:12 -04:00
parent d321616764
commit c60dec9d9a

View File

@@ -85,8 +85,6 @@ export default class Paginate extends Component {
* {...x} => represents page neighbours * {...x} => represents page neighbours
*/ */
fetchPageNumbers() { fetchPageNumbers() {
this.loadProps();
const totalPages = this.totalPages; const totalPages = this.totalPages;
const currentPage = this.state.currentPage; const currentPage = this.state.currentPage;
const pageNeighbours = this.pageNeighbours; const pageNeighbours = this.pageNeighbours;
@@ -135,6 +133,8 @@ export default class Paginate extends Component {
} }
render() { render() {
this.loadProps();
if (!this.totalRecords || this.totalPages === 1) return null; if (!this.totalRecords || this.totalPages === 1) return null;
const currentPage = this.state.currentPage; const currentPage = this.state.currentPage;