react-js-pagination icon indicating copy to clipboard operation
react-js-pagination copied to clipboard

Change activePage but Paga not change

Open amen160 opened this issue 1 year ago • 0 comments

Please help me. When I change activePage but Paga not change

import React, { Component } from 'react'; import Pagination from 'react-js-pagination';

class MyComponent extends Component { constructor(props) { super(props); this.state = { activePage: 1 }; this.handlePageChange = this.handlePageChange.bind(this); }

handlePageChange(pageNumber) { this.setState({ activePage: pageNumber }); }

goToNextPage() { const newActivePage = this.state.activePage + 1; this.handlePageChange(newActivePage); }

render() { return (

<Pagination key={this.state.activePage} activePage={this.state.activePage} itemsCountPerPage={10} totalItemsCount={450} pageRangeDisplayed={5} onChange={this.handlePageChange} /> <button onClick={() => this.goToNextPage()}>Next page
); } }

amen160 avatar Apr 25 '23 01:04 amen160