File: useresizelistener.md | Updated: 11/15/2025
Introducing PrimeReact v11 Alpha 🥁Learn More
SearchK
10.9.7
HOOK
API
Tracks window resize event.
Import#
import { useResizeListener } from 'primereact/hooks';
Copy
Basic#
Resize the browser window to view information about the resize event.
Width: 1280Height: 800
const [bindWindowResizeListener, unbindWindowResizeListener] = useResizeListener({
listener: (event) => {
setEventData({
width: event.currentTarget.innerWidth,
height: event.currentTarget.innerHeight,
})
}
});
Copy
Import
Basic
PrimeReact 10.9.7 by PrimeTek