diff --git a/src/views/BlogPage/hooks/useInfiniteScroll.ts b/src/views/BlogPage/hooks/useInfiniteScroll.ts index 84212136..3522a44c 100644 --- a/src/views/BlogPage/hooks/useInfiniteScroll.ts +++ b/src/views/BlogPage/hooks/useInfiniteScroll.ts @@ -1,6 +1,5 @@ -import { useEffect } from 'react'; +import { useEffect, useState } from 'react'; import { FetchNextPageOptions, InfiniteQueryObserverResult } from 'react-query'; -import useBooleanState from '@src/hooks/useBooleanState'; import useIntersectionObserver from '@src/hooks/useIntersectionObserver'; import { BlogResponse } from '@src/lib/types/blog'; @@ -8,23 +7,23 @@ export default function useInfiniteScroll(fetchNextPage: { (options?: FetchNextPageOptions): Promise>; (): void; }) { - const [hasObserved, setHasObserved, setHasUnObserved] = useBooleanState(false); + const [hasObserved, setHasObserved] = useState(false); const ref = useIntersectionObserver( async (entry, observer) => { if (!hasObserved && entry.isIntersecting) { fetchNextPage(); - setHasObserved(); + setHasObserved(true); } observer.unobserve(entry.target); - setHasUnObserved(); + setHasObserved(false); }, { rootMargin: '80px' }, ); useEffect(() => { - setHasUnObserved(); + setHasObserved(false); }, []); return { ref }; diff --git a/src/views/RecruitPage/components/ActivityReview/index.tsx b/src/views/RecruitPage/components/ActivityReview/index.tsx index e66419c8..e28caee0 100644 --- a/src/views/RecruitPage/components/ActivityReview/index.tsx +++ b/src/views/RecruitPage/components/ActivityReview/index.tsx @@ -44,7 +44,7 @@ export default function ActivityReview() { - {/* {reviews.data.map((review) => ( + {reviews.data.map((review) => ( - ))} */} + ))} onClickRightButton(scrollableRef.current)}>