Reference home > @af-utils/virtual-react > createListItemRef

createListItemRef() function

Creates callback ref for list item at specified index.

Signature:

createListItemRef: (model: VirtualScroller, itemIndex: number) => (el: HTMLElement | null) => void

Parameters

Parameter

Type

Description

model

VirtualScroller

VirtualScroller instance

itemIndex

number

item index

Returns

(el: HTMLElement | null) => void

callback ref

Remarks

Calls VirtualScroller.attachItem() when item is mounted and VirtualScroller.detachItem() when item is about to unmount.