【发布时间】:2020-01-12 06:33:32
【问题描述】:
我有一个现成的分页组件:https://www.npmjs.com/package/react-js-pagination
import React, { Component } from "react";
import ReactDOM from "react-dom";
import Pagination from "react-js-pagination";
require("bootstrap/less/bootstrap.less");
class App extends Component {
constructor(props) {
super(props);
this.state = {
activePage: 1,
todos: []
};
}
handlePageChange(pageNumber) {
console.log(`active page is ${pageNumber}`);
this.setState({activePage: pageNumber});
}
render() {
return (
<div>
<Pagination
activePage={this.state.activePage}
totalItemsCount={this.state.todos.length}
pageRangeDisplayed={2}
onChange={this.handlePageChange}
/>
</div>
);
}
}
如何将分页从react-js-pagination 转换为react-bootstrap 分页https://react-bootstrap.github.io/components/pagination/?
【问题讨论】:
-
您在提供的链接中拥有自己进行此转换所需的所有信息。如果您被困在与之相关的特定问题上,则需要更加清楚。到目前为止,您到底尝试了什么?您看到了什么错误或行为? StackOverflow 不存在简单地为您编写代码。先尝试自己做。
标签: javascript reactjs pagination react-bootstrap