A ReactJS component that creates a pagination .
- TODO 🚧
- Add more functionality like [ Go To Page ]
- Provide more listeners
- Publish it on npm central
- Done ✔️
- Provide basic functionality ....
import React, { Component } from 'react'
import Paginator from 'Paginator'
class Example extends Component {
constructor(props) {
super(props)
this.state = {
items: [],
}
this.onPageChanged = this.onPageChanged.bind(this)
}
onPageChanged = data => {
this.setState({
items: data.currentRecords,
})
}
// -------------------------- RENDER ---------------------------------------
render() {
const paginator = (
<Paginator
allRecords={items}
pageLimit={3}
currentPage={1}
pageNeighbours={1}
onPageChanged={this.onPageChanged}
/>
)
return (
<div style={{ marginTop: '10px', marginRight: '15px' }}>
{paginator}
</div>
)
}
}