npm.io
0.2.5 • Published 7 years ago

@oryono/react-paginator

Licence
MIT
Version
0.2.5
Deps
4
Size
538 kB
Vulns
0
Weekly
0

react-paginator npm version

The way you use it is similar to Laravel's paginator.

Installation

Through npm
npm install @oryono/react-paginator --save

Usage

import Paginator from '@oryono/react-paginator'
import React, { Component } from 'react'
import getUsers from './actions'

class ComponentName extends Component {
    // Your page handler could be something like this
    handlePageChange = page => {
        getUsers(page);
    };
    render () {
        return (
            <React.Fragment>
                  <Users />
                  <Paginator
                      totalCount={50}  /*This is the total number of items */
                      currentPage={1} /* Current page as from the api */
                      pageSize={10} /* Page size */
                      onPageChange={ this.handlePageChange } /* This is what happens when a page is clicked */
                  />
            </React.Fragment>

        )
                
    }
                
}

That's it.

You should consider contributing to this noble cause