useUpdateEffect

Executes a given callback when a stateful property is updated.


import { useUpdateEffect } from 'primereact/hooks';
         

Updating the value at blur event triggers a message.


const toast = useRef(null);
const [value, setValue] = useState('');

useUpdateEffect(() => {
    toast.current.show({ severity: 'info', summary: 'Updated' });
}, [value]);