Skip to content

Commit

Permalink
[DDW-923] Add comment for re callback usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Araujo committed Apr 19, 2022
1 parent 95adc83 commit 401024a
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export const useInViewPort = () => {
})
);

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

0 comments on commit 401024a

Please sign in to comment.