import { Pagination } from "antd";
const [currentPage, setCurrentPage] = useState(1);
const [itemPerPage, setItemPerPage] = useState(25);
const indexOfLastItem = currentPage * itemPerPage;
const indexOfFirstItem = indexOfLastItem - itemPerPage;
const currentItem = users.slice(indexOfFirstItem, indexOfLastItem);
//IMP. NOTE {(curretitem.map)map also run by curretitem}
<Pagination
total={users.length}
current={currentPage}
pageSize={itemPerPage}
onChange={(currentPage) => setCurrentPage(currentPage)}
/>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter