Repository navigation
Can hyper do infinite fetching? #116
Answered
by
prc5
npearson72
asked this question in
Q&A
|
I was looking through the docs and didn't see anything like this: useInfiniteQuery |
Answered by
prc5
Jul 23, 2025
Replies: 1 comment 1 reply
|
UPDATE: ORIGINAL: function Page({ offset }) {
const { data, error, loading } = useFetch(getList.setQueryParams({ offset }));
return (
<div>
{data.map((element) => (
<div>{element}</div>
))}
</div>
);
}
function Component() {
const [page, setPage] = useState(1);
const loadMore = () => {
setPage((page) => page + 1);
};
return (
<div>
{Array.from(Array(page).keys()).map((key) => (
<Page key={key} offset={key * 10} />
))}
<button onClick={loadMore}>Load More</button>
</div>
);
} |
1 reply
Answer selected by
prc5
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
UPDATE:
I just released dedicated hook
useInfiniteFetch()with HF v10! 🚀ORIGINAL:
Our approach in this case is similar to the SWR's approach with making micro components: