1

i use react-paginate package and for styling, I use styled-components in the react-paginate docs, it says to give the container a class I should use the className property for CSS in js libraries like styled components and for normal CSS I should use containerClassName I used both of them but none worked for styled-components the problem is it's getting the class i.e .container class but the styles won't apply the other classes like .active works but it's just the .container which is not getting the styles here's the code

import ReactPaginate from "react-paginate";
import styled from "styled-components";
const StyledReactPaginate = styled(ReactPaginate)`
  a {
    cursor: pointer;
  }
  .active {
    background: lime;
  }
  .container{
  display: flex;
  }
`;
const Pagination = (props) => {
  return (
    
      <StyledReactPaginate
        previousLabel={props.previousLabel}
        nextLabel={props.nextLabel}
        pageCount={props.pageCount}
        onPageChange={props.onPageChange}
        activeClassName={"active"}
        className={"container"}
      />
 
  );
};

export default Pagination;

Matin
  • 29
  • 7
  • I'm currently using the containerClassName temporarily which is for pure CSS styling instead of className which is for CSS in js styling and its working – Matin Jun 23 '22 at 22:09
  • Can you try to add something like background: green; in the styles of .container. Just to rule out that nothing is wrong with display: flex, because sometimes display: flex does nothing based on the above CSS properties – Tom Brooke Jun 23 '22 at 22:31

0 Answers0