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