How to set selected page react-paginate

638 Views Asked by At

When I load page with url zbcxyz?page=3. I get params page with searchParams.get("page"). I want to set selected page = 3. Tks enter image description here enter image description here I tried using focrePage but it didn't work

1

There are 1 best solutions below

2
Thusithz On BEST ANSWER

I think you need pass initialPage props

<ReactPaginate
      nextLabel="next >"
      initialPage={(parseInt(searchParams.get("page")) || 1) - 1}
      />