ZeeCoder / use-resize-observer

A React hook that allows you to use a ResizeObserver to measure an element's size.
MIT License
644 stars 42 forks source link

Removing width in declaration if don't needed #21

Closed Piero87 closed 4 years ago

Piero87 commented 4 years ago

Hi, in this line:

const [ref, width, height] = useResizeObserver();

How can I remove the width?

ZeeCoder commented 4 years ago

You can't with the current array return.

Could change the interface in the next major to:

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

Especially, as if #16 is implemented, as you wouldn't want the ref in that case either.