use new docs
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
import { useEffect } from "react"
|
||||
|
||||
export function useWindowEvent<EventType extends keyof WindowEventMap>(
|
||||
type: EventType,
|
||||
handler: (event: WindowEventMap[EventType]) => void,
|
||||
) {
|
||||
useEffect(() => {
|
||||
window.addEventListener(type, handler)
|
||||
return () => window.removeEventListener(type, handler)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user