jaredLunde / jaredLunde/react-hook

Support the box options property for `useResizeObserver`

Open
#298 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.5k
Forks
96
PR merge metrics
No merged PRs in 30d

Description

**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:

```js
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/

Contributor guide

Open the contributing guide

Research direction

Start at the useResizeObserver entry point and review its current arguments and ResizeObserver setup. Check how the hook exposes observer configuration, then verify that the requested box option can be passed through and that the pixel-perfect measurement example behaves as intended.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.