useOptionalDisposable Function

A custom hook which calls the factory method to create a disposable object which might as well be undefined. If the result was a disposable object, the hook takes care of disposing it when necessary.

useOptionalDisposable(createDisposable: () => undefined | TDisposable): TDisposable | undefined

Parameter Type Description
createDisposable () => undefined | TDisposable  

Returns - TDisposable | undefined

Defined in

Last Updated: 13 May, 2024