Skip to content

Commit

Permalink
Fix useVisible (#5715)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Jan 9, 2024
1 parent 4108881 commit b78d4db
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions components/templates/templateFeaturesAnimation/useVisible.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react';
import { useEffect, useState } from 'react';

const useVisible = (element, rootMargin = 0.2) => {
const [isVisible, setIsVisible] = useState(false);
Expand All @@ -8,7 +8,7 @@ const useVisible = (element, rootMargin = 0.2) => {
([entry]) => {
setIsVisible(entry.isIntersecting);
},
{ threshold: rootMargin },
{ threshold: rootMargin }
);

if (element.current) {
Expand All @@ -17,13 +17,13 @@ const useVisible = (element, rootMargin = 0.2) => {

return () => {
if (observer && element.current) {
observer.unobserve(element.current)
// eslint-disable-next-line react-hooks/exhaustive-deps
observer.unobserve(element.current);
}
}

}, []);
};
});

return isVisible;
};

export default useVisible;
export default useVisible;

0 comments on commit b78d4db

Please sign in to comment.