rc-pagination is a highly customizable and flexible React UI component for building pagination controls. While version 5.1.0 is the current stable release under this package name, the project has formally transitioned and is actively maintained as the `@rc-component/pagination` package. This library is renowned for its extensive API, offering deep customization options for appearance and behavior, including support for internationalization, quick page jumpers, page size changers, and custom renderers for individual page items. It serves as the foundational pagination logic for prominent UI libraries such as Ant Design, emphasizing accessibility and performance. Developers initiating new projects or upgrading should use `@rc-component/pagination` for the latest features and ongoing support, as `rc-pagination` is effectively superseded by the renamed package.
npm install rc-paginationVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates a basic functional React component using `rc-pagination`, managing page state, and showcasing common features like total display, size changer, and quick jumper. It includes the necessary CSS import and uses modern ReactDOM rendering.
For new projects or major upgrades, install `@rc-component/pagination` instead of `rc-pagination`. Update import paths accordingly: `import Pagination from '@rc-component/pagination';`
Refactor your component to use the new `sizeChangerRender` prop, which accepts a function to render a custom component for the size changer. Refer to the official API documentation for usage examples.
Ensure you import the default styles in your application's entry point or a relevant component file: `import 'rc-pagination/assets/index.css';`
Upgrade your project's `react` and `react-dom` packages to version `16.9.0` or newer to ensure compatibility.
Ensure the package is installed via `npm install rc-pagination` or `yarn add rc-pagination`. If you intend to use the newer version, install `@rc-component/pagination` instead and update your import statements.
Update your code to use the `sizeChangerRender` prop for customizing the page size changer. Consult the v5 API documentation for proper usage.
For modern React, ensure you have a valid DOM element (e.g., `<div id="root"></div>`) and use `ReactDOM.createRoot(container).render(<App />);` for rendering your application.