2.0.8 • Published 3 years ago

paginated-list v2.0.8

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

paginated-list

Add pagination to a list of React components

NPM JavaScript Style Guide

Install

npm install --save paginated-list

Usage

import React from 'react';
import PropTypes from 'prop-types';

import withPaginatedList from 'paginated-list';

const Element = ({ item }) => {
  return (
    <span>{item}</span>
  );
};

Element.propTypes = {
  item: PropTypes.string.isRequired
};

const App = () => {
  const elements = ['Test1', 'Test2', 'Test3', 'Test4', 'Test5', 'Test6', 'Test7', 'Test8'];

  const PaginatedList = withPaginatedList(Element, (offset, limit) => {
    return new Promise((resolve, reject) => {
      resolve({
        items: elements.slice(offset, offset + limit),
        totNumItems: elements.length
      });
    });
  }, 2, 5, true);
  return (
    <div>
      <PaginatedList />
    </div>
  );
};

export default App;

License

MIT © valearna

2.0.3

3 years ago

2.0.2

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.7

3 years ago

2.0.6

3 years ago

2.0.8

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.1.0

3 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago