New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
usePagination / usePaginator #55
Comments
I think we could do something like const ListComponent = () => {
const [list, loadMore] = useCursorPagination(
(cursor) => `http://my-site.com/list.php?cursor=${cursor}`,
(response) => [response.body.list, response.body.cursor],
);
return (
<>
{list.map(({item, key}) => <Item {..item} key={key} />)}
</>
);
}; |
In modern web app,We use rest-api for our data,I think cursor is a better description, but if i compose cursor and response in usePagination is not uneconomic. Most of us don't need your api in this component.What we should do is only show the Pagination UI.like this
|
@SnowFlowers I'm not in favor of adding UI components to this library as this is a hooks library. The hook should expose state and callbacks that can be used with any UI components. I think @streamich's example should maybe be called const {nextPage, prevPage, goToPage} = usePagination(initialPage); This is so simple and similar to |
@wardoost OK, I see. Maybe it's not a good part for this repo. |
The first thing I did when I found this repo was Anyone can do the aliasing on their own, but they could also implement their own |
What about that possible hook?
The text was updated successfully, but these errors were encountered: