roderickhsiao / react-aspect-ratio

Preserve space for your element to prevent browser reflow (layout shift)
https://roderickhsiao.github.io/react-aspect-ratio/
MIT License
103 stars 7 forks source link

Support passing refs to `AspectRatio` #80

Closed chrissantamaria closed 1 year ago

chrissantamaria commented 1 year ago

The types from #78 suggest that passing refs to AspectRatio is supported just like a native div, but this currently results in a dev warning that the ref isn't being passed to the underlying functional component.

This PR updates AspectRatio to use forwardRef to support this behavior.