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

useSubscription() function

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

Signature:

useSubscription: (model: VirtualScroller, events: readonly VirtualScrollerEvent[] | VirtualScrollerEvent[], callBack: () => void) => void

Parameters

Parameter

Type

Description

model

VirtualScroller

VirtualScroller instance

events

readonly VirtualScrollerEvent[] | VirtualScrollerEvent[]

array of VirtualScrollerEvent to subscribe

callBack

() => void

callback to be called

Returns

void

Remarks

For example can be used in load-on-demand.