UNPKG

@guruhotel/aura-hooks

Version:

🪝 Hooks library designed by the Guruhotel team for Aura UI

1 lines 253 B
import{useRef as r,useEffect as e}from"react";export function useEventListener(t,n,u){const i=r();return e((()=>{if(i.current)return i.current.addEventListener(t,n,u),()=>{var r;return null==(r=i.current)?void 0:r.removeEventListener(t,n,u)}}),[n,u]),i}