2.0.1 • Published 5 months ago
@trpc-swr/infinite v2.0.1
@trpc-swr/infinite
Documentation: https://trpc-swr.vercel.app/infinite-queries
// profile.tsx
const { data, error, size, setSize } = infinite.user.getMany.useCursor(
{ limit: 3 },
(index, previousPageData) => {
return previousPageData?.nextCursor;
}
);
const users = data?.pages.flat() || [];
const hasMore = data?.at(-1).nextCursor !== null;
return (
<div>
{users.map((user) => (
<div key={user.id}>{user.name}</div>
))}
{hasMore && (
<button
onClick={() => {
setSize(size + 1);
}}
>
Load more
</button>
)}
</div>
);
3.0.0-canary.1
5 months ago
3.0.0-canary.0
5 months ago
2.0.1
7 months ago
2.0.0
7 months ago
1.0.2
11 months ago
1.0.1
12 months ago
1.0.0
12 months ago
1.0.0-rc.2
1 year ago
1.0.0-rc.1
1 year ago
1.0.0-rc.0
1 year ago