useOptionalDisposable Function
Deprecated in 4.15.0. Use useState
+ useEffect
for creating and disposing disposable resources.
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<TDisposable extends IDisposable>(createDisposable: () => undefined | TDisposable): TDisposable | undefined
Parameter | Type | Description |
---|---|---|
createDisposable | () => undefined | TDisposable |
Returns - TDisposable | undefined
Defined in
Last Updated: 14 November, 2024
Found something wrong, missing, or unclear on this page?Raise an issue in our repo.