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 |
Beta Was this translation helpful? Give feedback.
Answered by
prc5
Jul 23, 2025
Replies: 1 comment 1 reply
-
Our approach in this case is similar to the SWR's approach with making micro components: 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>
);
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
prc5
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Our approach in this case is similar to the SWR's approach with making micro components: