Skip to content

Instantly share code, notes, and snippets.

View beausmyth1990's full-sized avatar
🏠
Working from home

Beau beausmyth1990

🏠
Working from home
  • Central Queensland (soon to be Brisbane)
View GitHub Profile
import { RefObject, useEffect, useRef } from 'react';
function useEventListener<K extends keyof MediaQueryListEventMap>(
eventName: K,
handler: (event: MediaQueryListEventMap[K]) => void,
element: RefObject<MediaQueryList>,
options?: boolean | AddEventListenerOptions,
): void;
function useEventListener<K extends keyof WindowEventMap>(