0.0.1 • Published 5 years ago

@mariosant/react-pagination-hook v0.0.1

Weekly downloads
19
License
MIT
Repository
-
Last release
5 years ago

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_ant – mariosant@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