Skip to content

Commit

Permalink
Fix: 린트 에러 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
2YH02 committed Aug 2, 2024
1 parent 15febba commit b64bae3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/hooks/useInview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ const useInView = (options?: IntersectionObserverInit) => {
setInView(entry.isIntersecting);
}, options);

if (ref.current) {
observer.observe(ref.current);
const currentRef = ref.current;
if (currentRef) {
observer.observe(currentRef);
}

return () => {
if (ref.current) {
observer.unobserve(ref.current);
if (currentRef) {
observer.unobserve(currentRef);
}
};
}, [options]);
Expand Down

0 comments on commit b64bae3

Please sign in to comment.