useUnmountEffect

当组件卸载时执行给定的回调函数。


import { useUnmountEffect } from 'primereact/hooks';
         

当盒子卸载时,在浏览器控制台中显示一条消息。

已挂载

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