Skip to content

Commit 401024a

Browse files
author
Lucas Araujo
committed
[DDW-923] Add comment for re callback usage
1 parent 95adc83 commit 401024a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

source/renderer/app/components/staking/stake-pools/hooks/useInViewPort.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export const useInViewPort = () => {
1111
})
1212
);
1313

14+
// React will call the ref callback twice. Once when the component mounts, and call it with again when it unmounts.
15+
// https://reactjs.org/docs/hooks-faq.html#how-can-i-measure-a-dom-node
1416
const setTargetRef = useCallback((target: HTMLElement) => {
1517
if (targetRef.current) {
1618
observerRef.current.unobserve(targetRef.current);

0 commit comments

Comments
 (0)