Skip to content

Commit

Permalink
chore: useCallback 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
jhj2713 committed Aug 19, 2024
1 parent 31f8bf3 commit 69886df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions admin/src/hooks/useInfiniteFetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function useInfiniteFetch<T, R>({
const [hasNextPage, setHasNextPage] = useState<boolean>(true);
const [totalLength, setTotalLength] = useState<number>(0);

const getDataList = (lastPage: R) => {
const getDataList = useCallback((lastPage: R) => {
if (isInfiniteParticipantListData<T>(lastPage)) {
setTotalLength(lastPage.totalParticipants);
return lastPage.participantsList;
Expand All @@ -45,7 +45,7 @@ export default function useInfiniteFetch<T, R>({
}

return [];
};
}, []);

const fetchNextPage = useCallback(async () => {
if (!hasNextPage || isLoading || currentPageParam === undefined) return;
Expand Down

0 comments on commit 69886df

Please sign in to comment.