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' });
});
         
Summer Sale 2025
SUMMER SALE2025
Use coupon code PRSM25 at checkout to get 50% OFF everything in PrimeStore and PrimeBlocks.
Learn More