forcePage doesn't work
See original GitHub issueIf I render this
class MyPagination extends Component {
constructor() {
this.state = { currentPage: 0 }
}
render() {
return (
<ReactPaginate
pageCount={10}
pageRangeDisplayed={3}
marginPageDisplayed={3}
forcePage={this.state.currentPage}
/>
)
}
}
Then click on pages, the selected
page changes. I would expect it to stay on page 0
I’d like to perform async actions after page click before having the change reflected. Is this possible given the current configuration options?
Issue Analytics
- State:
- Created 7 years ago
- Comments:30 (1 by maintainers)
Top Results From Across the Web
React Paginate Second Instance on same page does not re ...
To make both paginations work in sync - you have to set forcePage to be equal to the wrapper's state selected page numer....
Read more >react-paginate - npm
Name Type Description
pageCount Number Required. The total number of pages.
pageRangeDisplayed Number The range of pages displayed.
marginPagesDisplayed Number The number of pages to display...
Read more >Update not working for Visual Force Page fields
Looks like the Id of current page not retrieved for update operation. I am using this to update the record. ApexPages.currentPage().
Read more >visual force page not working when made public
Don't have an account? Signup for a Developer Edition. Browse by Topic. Apex Code Development (89281) ...
Read more >How to Refresh a Page or Component in React - Upmostly
React is a modern JavaScript library and therefore does not require a page refresh to display the latest data in the UI. A...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kevinch I simply do this
And the
currentPage
gets updated with each page click. And when I want to, I set it to0
and the first page gets selected. For example a reset button click handler or something like that.Just make sure that
currentPage
is always set toselected
value from theonPageChange
handler that you pass to React Paginate like so:Note how I set the
currentPage: selected
in the handler you pass to React Paginate, this is to make sure that the current page is the one the user selected, since we always send a value to forcePage. And then when I need to set a specific page, you update the state object with the page you want and It’ll re-render correctly.Try this out and let me know if it works for you.
Any progress on this? I have a several cases where I need to use forcePage. Cases with undefined by default work only once and then if state doesn’t change nothing happens.