jaredLunde / react-hook

↩ Strongly typed, concurrent mode-safe React hooks
https://npmjs.com/org/react-hook
MIT License
1.44k stars 97 forks source link

Support the box options property for `useResizeObserver` #298

Open noahlaux opened 1 year ago

noahlaux commented 1 year ago

Is your feature request related to a problem? Please describe. I'd like to be able to utilize the different resizing models for pixel perfect measuring

Describe the solution you'd like I'd like to be able to provide options to the resize observer upon creation

It could be done fx by providing a third parameter:

useResizeObserver(target, (entry) => setSize(entry.contentRect), { box: ['device-pixel-content-box']} );

Describe alternatives you've considered N/A

Additional context https://web.dev/device-pixel-content-box/