Leave Yamada UI a star

Star
Yamada UIYamada UIv1.7.2

useWindowEvent

useWindowEvent is a custom hook that assigns an event listener to window.

Source@yamada-ui/use-window-event

Import

import { useWindowEvent } from "@yamada-ui/react"
Copied!

Usage

Editable example

const [count, setCount] = useState(0)

useWindowEvent("click", () => {
  setCount((prev) => prev + 1)
})

return <Text>Click count: {count}</Text>
Copied!

Edit this page on GitHub

PrevioususeValueNextFigma