ZeeCoder / use-resize-observer

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

Basic usage is not working #92

Closed andyperlitch closed 2 years ago

andyperlitch commented 2 years ago

Hello there! I'm trying to get the absolute minimum usage example working, and am running into an issue. I have tried on linux and mac, on firefox and chrome, and cannot get it to work.

Here is a code sandbox reproducing it: https://codesandbox.io/s/exciting-surf-uos1hs?file=/src/App.js

You will see that the onResize function is being called with the new size, however, the width variable returned by useResizeObserver is not getting updated.

ZeeCoder commented 2 years ago

Hi! Thank you very much for the reproduction.

There seems to be 2 issues here:

I'm working on an update to make the hook compatible, so this'll be a good test case.

andyperlitch commented 2 years ago

I'm so glad my repro helped you out! Good to know about the onResize function.

github-actions[bot] commented 2 years ago

:tada: This issue has been resolved in version 9.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: