cf-builder-pagination
Cloudflare Pagination Builder
Installation
Installation with yarn is recommended
$ yarn add cf-builder-pagination
Usage
import React from 'react';import PaginationBuilder from 'cf-builder-pagination'; { const start = page - 1 * pageSize; const end = start + pageSize - 1; return start end;} { for let i = start; i <= end; i++ if !itemsi || itemsiisRequesting return false; return true;} Component { ; thisstate = items: totalCount: 143 page: 1 perPage: 20 ; thishandlePageChange = thishandlePageChange; } { this; } { this; } // This is mimicking what will happen in the API actions/reducers: { const items = thisstateitems; const start end = ; const needsRequest = !; if !needsRequest this; return; for let i = start; i <= end; i++ if !itemsi itemsi = isRequesting: true ; this; ; } { const start end = ; const loading = !; return <PaginationBuilder = = = = = /> ; } ;