I already installed react-pagination using below command:-
npm i react-bootstrap-4-pagination
My Code:-
import React, { Component } from "react"; import { Link } from "react-router-dom"; import Pagination from 'react-pagination'; let paginationConfig = { totalPages: 22, currentPage: 15, showMax: 5, size: "lg", threeDots: true, prevNext: true, href: 'https://example.com/items?page=*', // * will be replaced by the page number pageOneHref: 'https://example.com/items', borderColor: 'red', activeBorderColor: 'black', activeBgColor: 'grey', disabledBgColor: 'red', activeColor: 'red', color: 'purple', disabledColor: 'green', circle: true, shadow: true }; <Pagination threeDots totalPages={22} currentPage={15} showMax={7} prevNext activeBgColor="#18eaca" activeBorderColor="#7bc9c9" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>
Answer will be appreciated!
The problem is with the package documentation, as the import is stated incorrectly here at official page .
import Pagination from 'react-pagination';
above import statement should be
import Pagination from "react-bootstrap-4-pagination";
But it is stated correctly in the live demo provided at package officital page at codesandbox.io here code for live demo provided in official docs
You need to install react-pagination:
npm install react-bootstrap bootstrap
and import like this:
import Pagination from 'react-bootstrap/Pagination'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.