import Paginator, { usePaginator } from 'paginatorx-chakra';
import { TyourDataType } from 'your types folder';
const yourData: TyourDataType[] = useYourUseFetch;
const { pagesCount, selectedPage, setSelectedPage, pages } =
usePaginator < TyourDataType > (yourData, countPerPage);
<div>
{!!pages.length &&
pages[selectedPage].map((item: TyourDataType) => {
return <Item key={item.id} item={item} />;
})}
</div>
{
pages.length > 1 && (
<Paginator
pagesCount={pagesCount}
selectedPage={selectedPage}
setSelectedPage={setSelectedPage}
/>
);
}