lucasmogari / react-pagination Goto Github PK
View Code? Open in Web Editor NEWHeadless react hook for pagination
Home Page: https://react-pagination-docs.vercel.app/
Headless react hook for pagination
Home Page: https://react-pagination-docs.vercel.app/
I have a component where I can filter the items.
If the filter yields 0 results, the usePagination-hook returns old values forsize
and totalPages
.
E.g. I start with 70 items and show 10 items on each page.
The result is totalPages: 7
.
If I filter to show 40 items, totalPages
updates to 4.
However, if I then filter to show 0 items, totalPages
sticks to the old value and the result is still 4.
The issues seems to be in the paginationReducer
, where totalItems
is not updated when action.totalItems
is 0:
if (action.totalItems) {
totalItems = Number(action.totalItems);
}
Add the ability to hide the Previous
and Next
labels but keep the buttons with <
and >
This can help in layouts that has less space to show the pagination.
(it is important to keep aria-label
on these button to make it accessible)
P.S. - I will be happy to help and suggest a PR, but I am having technical issues with running the project. If you want to assist me - I can try to make this happen
Could not find a declaration file for module '@lucasmogari/react-pagination'. 'node_modules/@lucasmogari/react-pagination/dist/react-pagination.es.js' implicitly has an 'any' type.
There are types at 'node_modules/@lucasmogari/react-pagination/dist/src/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@lucasmogari/react-pagination' library may need to update its package.json or typings.ts
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.