-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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: useInviewport result support disconnect #2539
base: master
Are you sure you want to change the base?
Conversation
还有人审核吗? |
我觉得这种方式不够灵活,直接把 disconnect 暴露出来是不是就可以了,开发者自己去关闭监听,这样他想监听几次就几次, |
可以的,我抽空改一下 |
@crazylxr done,pls review~ |
可以实现 trigger once 效果,demo: https://codesandbox.io/s/jian-ting-yuan-su-ke-jian-qu-yu-bi-li-forked-vhwccy?file=/App.tsx |
返回值超过两个及以上时,再用数组解构就不太方便了,我推荐兼容数组解构 和 对接解构两种形式,参考:https://github.com/thebuilder/react-intersection-observer/blob/c9cef8fd0d3e611daa9697f9630d29d31d78767a/src/useInView.tsx#L133C1-L138C28 其他 hooks 同理,返回值多的时候都可以兼容下 数组解构 和 对接解构两种形式 @crazylxr 见哥,你觉着呢? |
@liuyib done, pls review ~ |
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
close #2531
💡 Background and solution
#2531
📝 Changelog
☑️ Self Check before Merge