import{useEffect}from'react';/** * A hook for creating event handlers. */exportdefaultfunctionuseEvent(event:string,handler:(e:KeyboardEvent|MouseEvent)=>void,passive=false,):void{useEffect(()=>{// initiate the event handlerwindow.addEventListener(event,handler,passive);// this will clean up the event every time the component is re-renderedreturnfunctioncleanup(){window.removeEventListener(event,handler);};});}