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

Viewed 6705

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.

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

Related