Function: useDisposableResource()
useDisposableResource<
T
>(initialize
,deps
?):undefined
|T
Any resource that is a PointerHolder and can be released, should be loaded using this hook. It takes care of properly releasing the resource when the component unmounts or dependencies change. There are certain cases like "fast refresh" or StrictMode that make useEffects execute multiple times. Also loading the resource can be async and this hooks handles all these cases properly.
Type Parameters
• T extends ReleasingResource
Parameters
• initialize
• deps?: DependencyList
Returns
undefined
| T