
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
react-virtual-infinite-scroll-hook
Advanced tools
A lightweight React hook for infinite scroll support with virtualized scrollbars (e.g. AntD Table).
A lightweight React hook for infinite scrolling with virtual scrollbars (like Ant Design tables).
Easily detect when the scrollbar thumb reaches the bottom and trigger data loading.
offset
& throttleDelay
hasMore
& loading
statesref
and CSS selectors
npm install react-virtual-infinite-scroll-hook
import { Table } from "antd";
import React, { useState, useEffect } from "react";
import useVirtualInfiniteScroll from "react-virtual-infinite-scroll-hook";
import { fetchData } from "../helpers/fetchData";
import { COLUMNS } from "../helpers/constants";
const AntdTableVirtualWithInfiniteScroll: React.FC = () => {
const [data, setData] = useState<any[]>([]);
const [page, setPage] = useState(1);
const [loading, setLoading] = useState(false);
const [hasMore, setHasMore] = useState(true);
const loadMore = async () => {
if (loading || !hasMore) return;
setLoading(true);
const newData = await fetchData(page, 10);
setData((prev) => [...prev, ...newData]);
setHasMore(newData.length > 0);
setPage((p) => p + 1);
setLoading(false);
};
useVirtualInfiniteScroll({
onLoadMore: loadMore,
hasMore,
loading,
scrollbarSelector: ".ant-table-tbody-virtual-scrollbar-vertical",
// thumbSelector: ".ant-table-tbody-virtual-scrollbar-thumb",
offset: 80, // trigger 80px before bottom
throttleDelay: 100, // throttle observer updates
debug: true, // see logs in console
enabled: true,
});
useEffect(() => {
loadMore();
}, []);
return (
<div style={{ maxWidth: 700 }}>
<Table
bordered
columns={COLUMNS}
loading={loading}
dataSource={data}
pagination={false} //👈 disable pagination
virtual={true} // 👈 enable virtual table
scroll={{ y: 500 }} // 👈 Virtual table container height
/>
</div>
);
};
export default AntdTableVirtualWithInfiniteScroll;
Prop | Type | Default | Description |
---|---|---|---|
onLoadMore | () => void | req | Called when scroll reaches bottom |
hasMore | boolean | req | If false , stops triggering loads |
loading | boolean | req | Prevents multiple calls while loading |
offset | number | 0 | Trigger before reaching bottom (px) |
throttleDelay | number | 200 | Throttle delay for scroll handler (ms) |
scrollbarRef | React.RefObject<HTMLElement> | null | Ref for scrollbar container (preferred) |
scrollbarSelector | string | null | CSS selector for scrollbar (fallback) |
thumbSelector | string | null | CSS selector for scrollbar thumb |
enabled | boolean | true | Enable/disable infinite scroll |
debug | boolean | false | Log debug info |
MIT © Sudip Kundu
FAQs
A lightweight React hook for infinite scroll support with virtualized scrollbars (e.g. AntD Table).
The npm package react-virtual-infinite-scroll-hook receives a total of 2 weekly downloads. As such, react-virtual-infinite-scroll-hook popularity was classified as not popular.
We found that react-virtual-infinite-scroll-hook demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.