1.0.1 • Published 6 years ago

pagination-with-react v1.0.1

Weekly downloads
19
License
-
Repository
github
Last release
6 years ago

Project Title

React Pagination

Documentation

Props

PropType
currentActiveIndexNumber
childrenchildren app
numberOfPagesPerScreenNumber, How many pages numbers should user see per screen?
totalNumberOfPagesNumber, Total number of pages
onPageButtonClickFunction, callback function for onClick pagination button to get the current page number
prefixString or React Component, if you want to add anything before pagination buttons
suffixString or React Component, if you want to add anything after pagination buttons
iconsObject with keys left, leftMost, right, rightMost if you want to change the icons of a arrow
Icons Default Values
icons: {
  left: <span>&larr;</span>,
  leftMost: <span>&#8647;</span>,
  right: <span>&rarr;</span>,
  rightMost: <span>&#8649;</span>,
}

Installing

npm install pagination-with-react

import React from 'react';
import ReactDOM from 'react-dom';
import { ReactPagination  } from 'pagination-with-react';

class App extends React.Component{
  constructor(){
    super()
    this.state={
      id: 1,
    }
  }
  render() {
    return (
      <ReactPagination
        totalNumberOfPages={50}
        numberOfPagesPerScreen={10}
        onPageButtonClick={(id) => {
          this.setState({
            id,
          })
          console.log(this.state)
        }}
        currentActiveIndex={this.state.id}
      >
        <h1>Children {this.state.id}</h1>
      </ReactPagination>
    )
  }
}