[英]Module not found: Can't resolve 'react-pagination'
I already installed react-pagination using below command:-我已经使用以下命令安装了 react-pagination:-
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 .问题出在 package 文档上,因为官方页面上的导入说明不正确。
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但它在package官方页面上的codeandbox.io提供的现场演示中正确说明了官方文档中提供的现场演示代码
You need to install react-pagination:您需要安装反应分页:
npm install react-bootstrap bootstrap
and import like this:并像这样导入:
import Pagination from 'react-bootstrap/Pagination'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.