RollingPaperTeam / rolling-papaer-web

Apache License 2.0
1 stars 1 forks source link

[CREATE] Day9 이나경 79 네트워크 통신 custom hook 구현 #80

Closed nakyoung98 closed 8 months ago

nakyoung98 commented 8 months ago

이 PR은 어떤 유형인가요?

설명

async 함수를 다루는 useAsync 커스텀 훅

  1. isError

    • 에러발생시 true
    • 기본 false
  2. wrappedFunction

    • useAsync의 param으로 전달받은 api 함수를 감싼 함수
    • param으로 api함수의 param에 맞는 인자를 전달
    • 성공적으로 완료 시 api 결과 값 반환

CardLazyGridContainer에 useAsync 훅 적용

  useEffect(() => {
    //TODO: 실제 데이터 가져오기
    getCards(nextCardIndex, limit);
  }, []);
  const handleInfiniteLoadingObserver = useCallback(
    (entries) => {
      const target = entries[0];
      if (target.isIntersecting) {
        getCards(nextCardIndex, limit);
      }
    },
    [getCards, nextCardIndex, limit]
  );

관련 티켓 및 문서

스크린샷, 녹화

ezgif com-video-to-gif-converted (4)

변경사항을 테스트하는 방법, 테스트에 사용된 기기 및 브라우저, UI 변경에 대한 관련 이미지 등에 대한 지침을 이곳에 기재해 주세요.

UI 접근성 체크리스트

UI 변경 사항이 있는 경우, 이 체크리스트를 활용하세요:

[선택사항] 이 PR을 가장 잘 설명하는 GIF는 무엇인가요?

giphy (4)