• Registers a function in the current component scope which is called when component is destroyed. For function component this must be used within the component function. For class components it must be used in the constructor or the render method. When used anywhere else then the destroy handler is never called.

    Parameters

    • destroy: () => void

      The destroy handler function to register.

    Returns void