maslianok / react-resize-detector

A Cross-Browser, Event-based, Element Resize Detection for React
http://maslianok.github.io/react-resize-detector/
MIT License
1.25k stars 91 forks source link

Fix ref type #149

Closed maslianok closed 3 years ago

maslianok commented 3 years ago

Defaults to any

const { width, height, ref } = useResizeDetector();

<div ref={ref}>  // ref: React.MutableRefObject<any>

With typings

const { width, height, ref } = useResizeDetector<HTMLDivElement>();

<div ref={ref}>  // ref: React.MutableRefObject<HTMLDivElement>