@mariosant/react-pagination-hook

0.0.1 • Public • Published

Pagination Hook for React

Create paginated content with this easy to use React Hook

NPM version Build Status

Installation

Add @mariosant/react-pagination-hook to your package.json.

$ npm install @mariosant/react-pagination-hook

You can now import the module and use it like

import usePagination from '@mariosant/react-pagination-hook';

const Component = ({data}) => {
	const {
		nextPage,
		previousPage,
		paginated,
	} = usePagination(data) // data must be an array

	return (
		<div>
			{paginated.map(record => (
				<div key={record.key}>{record}</div>
			))}
			<button onClick={previousPage}>Previous</button>
			<button onClick={nextPage}>Next</button>
		</div>

	)

Usage

WIP

Development

WIP

Meta

Marios Antonoudiou – @marios_antmariosant@sent.com

Distributed under the MIT license.

https://github.com/mariosant/react-pagination-hook

Contributing

  1. Fork it (https://github.com/mariosant/react-pagination-hook/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes using a semantic commit message.
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

Readme

Keywords

none

Package Sidebar

Install

npm i @mariosant/react-pagination-hook

Weekly Downloads

74

Version

0.0.1

License

MIT

Unpacked Size

20 kB

Total Files

18

Last publish

Collaborators

  • mariosant