-
Notifications
You must be signed in to change notification settings - Fork 624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clickCallback gets called without a click #91
Comments
Hello @hackingbeauty, Indeed, when react-paginate first gets displayed on a page, it automatically calls the clickCallback handler. That's because the clickCallback function is supposed to be the place where you load the content you want to display on a particular page. As you can initialize the component to display the page of your choice (page 6 for example), it will call the clickCallback at first in order to load the content of page 6. I hope this helps. |
the first data has been fetched, then the i don't think automatically calls the clickCallback is good. |
Having issues because of this too. Being called on mount causes me a loop. |
A solution could be to add another props like |
Might this be causing an issue where my initial page is linked to [2], where as [1] links to a non existent page-0 ? I created this ticket btw: #104 |
One thing i just noticed is that the demo provided on this repo doesn't call the 'clickCallback' on load. |
Looks like if you use |
@terencechow spot on, seems to be working on my end using |
For your information, since react-paginate 3.0.0, the |
Yes the callback is still called because: #116 <ReactPaginate previousLabel={"previous"}
nextLabel={"next"}
initialPage={1} // Remove this line
pageCount={this.state.pageCount}
onPageChange={this.handlePageClick} /> Is it OK for you this way? |
By removing that line, callback will not be called. This works if you always have |
Yes indeed. So, you're right, adding a boolean flag to change this behaviour if needed may be a good idea. |
Hello,
I noticed that when react-paginate first gets displayed on a page, it automatically calls the clickCallback handler.
I don't want it to do this. I just want the clickCallback handler called when a page number is clicked.
Am I doing something wrong?
The text was updated successfully, but these errors were encountered: