Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Material-UI - TablePagination - onChangePage is not a function

I have upgraded from Material-UI v4 to v5 and am now getting the following error:

TypeError: onChangePage is not a function

function handleNextButtonClick(row) {
 >    onChangePage(row, page + 1);
}

It appears that the onChangePage prop is now undefined within the TablePaginationActions component.

like image 892
tonysepia Avatar asked Mar 16 '26 18:03

tonysepia


1 Answers

In Material-UI v5 the prop name has changed from onChangePage to onPageChange.

I simply had to change the property name in the TablePagination component, as well as in all places where this prop is used within the TablePaginationActions component.

To simplify migration to v5 I recommend to go through all breaking changes on this official page

like image 56
tonysepia Avatar answered Mar 19 '26 09:03

tonysepia



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!