npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

catify-react-pagination

v1.0.7

Published

A simple React Component to use catify-pagination

Downloads

4

Readme

Catify React Pagination

Catify React Pagination is a utility component that provides pagination functionality for a given dataset in React applications. It allows you to easily implement pagination and navigate through data in a paginated manner. This component is part of the Catify JS library. It uses https://www.npmjs.com/package/catify-pagination underneath the hood.

Usage

  1. Import the necessary dependencies:

import { Pagination } from "catify-pagination"; import { useState, useEffect, useRef } from "react";

  1. Import the catify-react-pagination component:

import { PaginationComponent } from "catify-react-pagination";

  1. Create a React component that uses the PaginationComponent:

`const YourComponent = () => { // Define your data and itemsPerPage

const renderCallback = (data, page, totalPages) => { // Implement your logic to update the UI with the current page data, page number, and total pages };

useEffect(() => { // Initialize pagination const paginationRef = new Pagination(data, itemsPerPage, renderCallback);

// Render initial pagination
paginationRef.render();

}, [data, itemsPerPage]);

return ( {/* Render your content */} ); };`

  1. Customize the renderCallback function to update your UI with the current page data, page number, and total pages.

  2. Implement the rendering logic in your component's JSX to display the paginated data and the pagination links.

  3. Make sure to provide a valid DOM element with the id "pagination" where the pagination links will be rendered.

Props

The PaginationComponent accepts the following props:

  • data (array): The array of data to be paginated.
  • itemsPerPage (number): The number of items to be displayed per page.

Example

Here is a codebox vanilla javascript implementation: https://codesandbox.io/s/catify-pagination-react-example-l7b693

License

This project is licensed under the MIT License.

Issues

If you encounter any issues or have suggestions for improvements, please create an issue on the GitHub repository.

Author

This utility was developed by MagicTheCat.

More Information

For more information, please visit the GitHub repository.