useControlledTreeEventsHandler Function

Custom hook which creates and takes care of disposing a TreeEventHandler. The input is either a factory method for a custom TreeEventHandler implementation or parameters for the default implementation.

useControlledTreeEventsHandler<TEventsHandler extends TreeEventHandler>(factoryOrParams: TreeEventHandlerParams | () => TEventsHandler): undefined | TreeEventHandler

@note Caller must ensure factoryOrParams changes only when a new handler needs to be created. useCallback or useMemo can be used for that purpose based on whether the input is a factory function or params object.

@returns undefined on first render and a valid TreeEventHandler on all subsequent renders.

Parameter Type Description
factoryOrParams TreeEventHandlerParams | () => TEventsHandler  

Returns - undefined | TreeEventHandler

undefined on first render and a valid TreeEventHandler on all subsequent renders.

Defined in

Last Updated: 14 November, 2024