Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-pagination styling in global css not working

i'm just learning react and wanted to used react-paginate for pagination purpose but the styling is not working atm even though i've already put the necessary css on my global css file(index.css)

<div id="react-paginate">
    <ReactPaginate
        previousLabel={'<'}
        nextLabel={'>'}
        breakLabel={<a href="">...</a>}
        breakClassName={'break-me'}
        pageCount={pageCount}
        marginPagesDisplayed={2}
        pageRangeDisplayed={10}
        onPageChange={this.handlePageClick}
        containerClassName={'pagination'}
        subContainerClassName={'pages pagination'}
       activeClassName={'active'}
    /> 
</div>

my css file

#react-paginate ul {
   display: inline-block;
   margin-left: 20px;
   padding-left: 0;
}

#react-paginate li {
   display: inline-block;
   border: 1px solid rgb(224, 224, 224);
   color: #000;
   cursor: pointer;
   margin-right: 3px;
   border-radius: 5px;
   margin-bottom: 5px;
}

 #react-paginate li a {
     padding: 2px 5px;
     display: inline-block;
     color: #000;
     outline: none;
 }

#react-paginate li.active {
   background: rgb(224, 224, 224);
   outline: none;
}

any help would be appreciated, thank you

like image 375
Mike Avatar asked Sep 24 '18 10:09

Mike


People also ask

How do you add pagination in react JS in hooks?

Requirements. Create your react project yarn create react-app projectname and install the required modules yarn add axios react-paginate and then open your app. js file. We will first import our hooks from the react and also import the required modules.

Why we use pagination in react JS?

Pagination in React JS is a function of apps that allows them to show data on a series of pages. The information can be seen by going from one page to the next rather than viewing it. This process is frequently done in conjunction with server-side technology that allows clients to make group requests for data.


1 Answers

If you are using bootstrap 4 use below classes

 breakClassName={'page-item'}
 breakLinkClassName={'page-link'}
 containerClassName={'pagination'}
 pageClassName={'page-item'}
 pageLinkClassName={'page-link'}
 previousClassName={'page-item'}
 previousLinkClassName={'page-link'}
 nextClassName={'page-item'}
 nextLinkClassName={'page-link'}
 activeClassName={'active'}
like image 110
Kruti Choksi Patel Avatar answered Sep 28 '22 04:09

Kruti Choksi Patel