useWindowEvent

useWindowEventは、windowへ指定されたイベントリスナーを割り当てるカスタムフックです。

Click count: 0

使い方

import { useWindowEvent } from "@yamada-ui/react"
const [count, setCount] = useState(0)

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