Module not found: Can't resolve 'react-pagination'

5.1k Views Asked by At

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!

2

There are 2 best solutions below

0
On BEST ANSWER

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

0
On

You need to install react-pagination:

npm install react-bootstrap bootstrap

and import like this:

import Pagination from 'react-bootstrap/Pagination'