Skip to main content
Version: 5.4.0

useOnWindowResize

About#

A React hook for adding an event listener for window resize

Installation#

npm install --save @rooks

Importing the hook#

import {useOnWindowResize} from "@rooks"
`s``
## Usage
```jsx
function Demo() {
useOnWindowResize(() => console.log("window resized"))
return <p> Hello world </p>
}
render(<Demo/>)

Arguments#

ArgumentsTypeDescriptionDefault value
callbackfunctionCallback function which needs to run on unmountundefined
whenbooleanWhen the event handler should be activetrue

A React hook for adding an event listener for window resize#

Join Bhargav's discord server#

You can click on the floating discord icon at the bottom right of the screen and talk to us in our server.

Last updated on by imbhargav5