useWindowEvent
useWindowEvent
is a custom hook that assigns an event listener to window
.
Import
import { useWindowEvent } from "@yamada-ui/react"
Usage
Editable example
const [count, setCount] = useState(0) useWindowEvent("click", () => { setCount((prev) => prev + 1) }) return <Text>Click count: {count}</Text>
Edit this page on GitHub