Replies: 2 comments
-
我觉得可以给threshold套一个useRef,但是整体代码看起来不太美观 |
Beta Was this translation helpful? Give feedback.
0 replies
-
类似于 useInViewport 中使用的 useEffectWithTarget 这个东西,也就是 createEffectWithTarget,其内部使用了 depsAreSame 对比依赖,depsAreSame 算法如下: hooks/packages/hooks/src/utils/depsAreSame.ts Lines 1 to 9 in 2ff3ed9 可以看到,对于数组类型,做了一层深比较。所以,直接写数组没有性能问题 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Beta Was this translation helpful? Give feedback.
All reactions