Skip to content

react-bootstrap pagination, how to use ? #3281

@annieannie

Description

@annieannie

Hi,

(1) src/component/PaginationBasicFile.js has code:
the latest pagination code from https://react-bootstrap.github.io/components/pagination/  :

let active = 7;
let items = [];
for (let number = 1; number <= 10; number++) {
items.push(
<Pagination.Item active={number === active}>{number}</Pagination.Item>
);
}

const paginationBasic = (

{items}
<Pagination bsSize="medium">{items}</Pagination>
<br />

<Pagination bsSize="small">{items}</Pagination>
);

render(paginationBasic);

(2) How to use this in below case : there is an App.js file in src folder and a component folder in src:
src/App.js,
src/component/PaginationBasicFile.js

(3) can paginationBasic be exported from src/component/PaginationBasicFile.js like:
export default paginationBasic;

and imported in src/App.js like:
import paginationBasic from './components/PaginationBasicFile';
??
can paginationBasic be used in App.js like:
class App extends Component {

constructor(props) {
super(props);

this.state = {
  active: 1,
  limit: 50,
  offset: 0,
  totalPages: 0
};

this.handlePaginationSelect = this.handlePaginationSelect.bind(this);
}
handlePaginationSelect(selectedPage) {
console.log(selectedPage);
let offset = this.state.limit * selectedPage;
this.setState({
active: this.state.selectedPage
})
}
handleLimitChange (event) {
this.setState({
limit: +event.target.innerHTML || this.state.count,
activePage : 1
})
}
render() {
return (

);} } export default App;

(4) what is the correct method to use latest pagination?

Thank You.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions