File: useprevious.md | Updated: 11/15/2025
Introducing PrimeReact v11 Alpha 🥁Learn More
SearchK
10.9.7
HOOK
API
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