How do I send current page no to onChange in Pagination fo material ui?

Viewed 4466
<Pagination
      count={pageCount}
      color="primary"
      onChange={() => props.onPageChange()}
 />

I am trying to send the current page number to onChange.

1 Answers

You should use it like this:

onChange={props.onPageChange}

and the onChange function should look like this:

onPageChange = (event, value)

Value parameter is the number of your current page that is exposed as an argument of this function by the Pagination component itself. See this code sendbox: https://codesandbox.io/s/bn7nw?file=/demo.js

Related