Compute the page numbers and the handlers of a pagination, with dots when there are many pages.
This is custom React hooks, you need to follow the Basic Rules when you use it.
Twenty pages, with dots between the ranges.
const usePagination = (options: {
total: number
page?: number
initialPage?: number
siblings?: number
boundaries?: number
onChange?: (page: number) => void
}) => {
range: (number | 'dots')[]
active: number
setPage: (page: number) => void
next: () => void
previous: () => void
first: () => void
last: () => void
}