useUnmountEffect

Executes a given callback when component is unmounted.


import { useUnmountEffect } from 'primereact/hooks';
         

A messages is displayed at browser console when the box is unmounted.

Mounted

useUnmountEffect(() => {
    toast.current && toast.current.show({ severity: 'info', summary: 'Unmounted' });
});