Material UI Table pagination is zero-indexed, which means if I am on page 1, it will go back to page 0. How can I enforce to stop at page 1?

I try passing something like this, page={pageNumber || 1}, but it still calls onChangePage. Even though it does not try to load Page 0, but still its bad User Experience. You expect the previous button to be disabled in the below screenshot,

https://material-ui.com/api/table-pagination/#tablepagination-api
I don't know if I have the best solution, but I make it work, by subtracting -1 when feeding to page={pageNumber - 1}, and add +1 when onChangePage = (e, pageNumber) => {..pageNumber + 1} is called.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With