Skip to content

Instantly share code, notes, and snippets.

@cuonggt
Last active September 13, 2018 08:33
Show Gist options
  • Save cuonggt/cbadd47820b6535b8c1c05f5fb1b7ab3 to your computer and use it in GitHub Desktop.
Save cuonggt/cbadd47820b6535b8c1c05f5fb1b7ab3 to your computer and use it in GitHub Desktop.
Demo paginator
import React, { Component } from 'react';
import Paginator from './Paginator';
class App extends Component {
state = {
currentPage: 1,
total: 686,
perPage: 10,
};
handlePageChanged = (page) => {
this.setState({
currentPage: page,
});
// call request to refresh data
};
render() {
const {
currentPage, total, perPage,
} = this.state;
return (
<Paginator
currentPage={currentPage}
total={total}
perPage={perPage}
handlePageChanged={this.handlePageChanged}
/>
);
}
};
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment