-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Implement useIntersection hook. #652
Implement useIntersection hook. #652
Conversation
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.
Looks great 👏
I have a few small comments + would you be able to add tests?
Link to Intersection Observer docs.
I'm not sure how to test the main functionality of the hook, as it requires a ref and elements intersecting via scrolling. It's likely possible by using a library to fully render the DOM and then force scroll events. Any thoughts on a test approach would be appreciated. 😃 |
@kevinnorris I recently created a hook very similar to this and used shopify mocks for the testing
|
@kevinnorris I think you could either
I'm not sure what is best in this case, @Belco90 might have a suggestion on this. |
Never done this before for |
# [12.4.0](v12.3.2...v12.4.0) (2019-10-12) ### Features * useIntersection ([#652](#652)) ([d5f359f](d5f359f))
🎉 This PR is included in version 12.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
As described in #604.