Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
react-virtual-list
Advanced tools
Super simple virtualized list React component
This React component allows you to display a large list of fixed-height items in your document, while only rendering the items visible in the viewport. This allows a large list to be rendered with much fewer DOM elements.
You can use NPM to install react-virtual-list:
$ npm install react-virtual-list --save
The ./dist/VirtualList.js
module exports a single React component.
var VirtualList = require('react-virtual-list');
<VirtualList items={this.props.items} renderItem={this.renderItem} itemHeight={this.props.itemHeight} />
items
the full array of list items. Only the visible subset of these will be rendered.renderItem
a function to render a single item, passed as argument item
. Must return a single React element (React.createElement(...)
)itemHeight
the height in pixels of a single item. You must have a CSS rule that sets the height of each list item to this value.container
the scrollable element that contains the list. Defaults to window
. Use this if you have a list inside an element with overflow: scroll
.tagName
the tagName for the root element that surrounds the items rendered by renderItem. Defaults to div
. Use this if you want to render a list with ul
and li
, or any other elements.scrollDelay
the delay in milliseconds after scroll to recalculate. Defaults to 0
. Can be used to throttle recalculation.itemBuffer
the number of items that should be rendered before and after the visible viewport. Defaults to 0
.Any other properties set on VirtualList
, such as className
, will be reflected on the component's root element.
visibleItems
the currently visible array of items. Can be used to figure out which items are in the viewport. Eg: var items = this.refs.list.visibleItems()
Check out https://github.com/developerdizzle/react-virtual-list/blob/gh-pages/App.jsx for the example used in the demo.
Use npm test
to run the tests using jasmine-node. Currently only the math calculations are tested. Hoping to add some DOM tests as well.
FAQs
Super simple virtualized list React higher-order component
We found that react-virtual-list demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.