![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
A hook for paginating an array
npm install --save use-paging
import React, { useState } from "react";
import { usePaging } from "use-paging";
const ROWS1 = ["A1", "A2", "B1", "B2", "C1"];
const ROWS2 = ["X1", "X2", "Y1"];
export default () => {
const [rows, setRows] = useState(ROWS1);
const pages = usePaging(rows, { perPage: 2 });
return (
<>
<div>
{pages.currentPage.map((row, i) => (
<div key={i}>{row}</div>
))}
</div>
<div>
<button onClick={pages.firstPage}>First</button>
<button onClick={pages.prevPage}>Prev</button>
<button onClick={pages.nextPage}>Next</button>
<button onClick={pages.lastPage}>Last</button>
</div>
<div>
<button onClick={() => setRows(rows === ROWS1 ? ROWS2 : ROWS1)}>
Change List
</button>
Num pages: {pages.numPages}
</div>
</>
);
};
Next page
const options = {
perPage : 2 // Default is 30
}
const pages = usePaging(someArray, options) // note: the options object can be omitted
// usePaging state:
// To iterate across the current page
pages.currentPage.map((row, i) => (
<div key={i}>{row}</div>
))
// Current page index
console.log(pages.pageIndex)
// Total pages
console.log(pages.numPages)
// usePaging actions:
// Skip to the first page
pages.firstPage()
// Skip to the next page
pages.nextPage()
// Skip to the previous page
pages.prevPage()
// Skip to the last page
pages.lastPage()
// To use a different set of rows (the pageIndex is kept)
pages.setRows(newArray)
// Jump to an arbitrary 0-based page index (e.g. jump to page at index 5)
pages.jumpToPage(5)
MIT © mindlapse
This hook is created using create-react-hook.
FAQs
A hook for paginating an array
The npm package use-paging receives a total of 3 weekly downloads. As such, use-paging popularity was classified as not popular.
We found that use-paging demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.