📄 primereact/hooks/useprevious

File: useprevious.md | Updated: 11/15/2025

Source: https://primereact.org/hooks/useprevious/

Introducing PrimeReact v11 Alpha 🥁Learn More

usePrevious

Allows access to the previous value in state.

Import#


import { usePrevious } from 'primereact/hooks';
         

Copy

Basic#


Previous value remains one step behind the current value while input is being typed.

Current: Previous:

const [value, setValue] = useState('');
const prevValue = usePrevious(value);
         

Copy

  • Import

  • Basic

PrimeReact 10.9.7 by PrimeTek