-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: new hook useResizeObserver
#67
Conversation
Codecov Report
@@ Coverage Diff @@
## master #67 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 24 25 +1
Lines 306 344 +38
Branches 60 69 +9
=========================================
+ Hits 306 344 +38
Continue to review full report at Codecov.
|
8dc0d88
to
2a20eb8
Compare
c5f1bae
to
afa4cc0
Compare
afa4cc0
to
0ad8755
Compare
915282c
to
5369a94
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Questions:
- Why use this over something like https://www.npmjs.com/package/react-resize-detector ?
- Why is this under "Sensor"?
- Why implement this as an observer instead of as a state?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved after looking at useMeasure. Note my questions above.
There is only few about it, maybe there is more - dont wanna waste the time.
Where it should be? It acts like a sensor - something changes (in terms of element size or position) - it triggers.
Thus it is more versatile, as for me - im using this hook instead of |
# [1.21.0](v1.20.4...v1.21.0) (2021-05-25) ### Features * new hook `useResizeObserver` ([#67](#67)) ([ccf2c26](ccf2c26))
🎉 This PR is included in version 1.21.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What new hook does?
Invokes a callback whenever ResizeObserver detects a change to target's size.
Checklist
react-use
#33