Reference home > @af-utils/virtual-react

virtual-react package

React components, hooks and utils used to connect to VirtualScroller

Functions

Function

Description

createGridItemRef(rowsModel, rowItemIndex, colsModel, colItemIndex)

Creates callback ref for grid item at specified index.

createListItemRef(model, itemIndex)

Creates callback ref for list item at specified index.

List(props)

React component. Small abstraction, which in 90% cases allows to avoid hook boilerplate.

mapVisibleRange(model, cb)

Map current visible items

mapVisibleRangeWithOffset(model, cb)

Map current visible items and provide offset for each item.

Subscription(props)

React component. Rerenders only on certain VirtualScrollerEvent. Allows to optimize performance.

useComponentSubscription(model, events)

React hook. Rerenders component when one of VirtualScrollerEvent gets emitted.

useScroller(model, scroller)

React hook. Synchronizes scroller with model.

useSubscription(model, events, callBack)

React hook. Allows to subscribe to VirtualScrollerEvent without unnecessary rerenders.

useSyncedStyles(model)

React hook. Optimal CSS markup for virtual scroll is not intuitive. Use this hook to avoid unneeded boilerplate.

useVirtual(params)

React hook. Calls useVirtualModel() and synchronizes it with props

useVirtualModel(params)

React hook. Creates and stores one VirtualScroller instance. It is not recreated during component lifecycle.

Interfaces

Interface

Description

ListItemProps

Props passed to List item

ListProps

List() component props

SubscriptionProps

Subscription() component props