[Week6/mission] Tanstack Query 입문 1편: useQuery와 useInfiniteQuery로 무한 스크롤과 효율적인 데이터 패칭하기#34
Merged
starvingorange merged 8 commits intogang/mainfrom May 13, 2025
Merged
[Week6/mission] Tanstack Query 입문 1편: useQuery와 useInfiniteQuery로 무한 스크롤과 효율적인 데이터 패칭하기#34starvingorange merged 8 commits intogang/mainfrom
starvingorange merged 8 commits intogang/mainfrom
Conversation
…ken 관리 방법, Google 로그인 실습)
…ken 관리 방법, Google 로그인 실습)
S-Gihun
added a commit
that referenced
this pull request
May 8, 2025
S-Gihun
added a commit
that referenced
this pull request
May 8, 2025
S-Gihun
added a commit
that referenced
this pull request
May 8, 2025
S-Gihun
added a commit
that referenced
this pull request
May 8, 2025
leetaesk
approved these changes
May 9, 2025
JeonSuna
approved these changes
May 9, 2025
S-Gihun
approved these changes
May 9, 2025
JeonSuna
approved these changes
May 9, 2025
JeonSuna
left a comment
There was a problem hiding this comment.
수고하셨어요!!
갱주님 많이 급하셨나봐요!!! /apis/lp.ts에서 comment api 불러올 때 v1앞에 "/"가 빠져있어욤!!
수정하면 좋을 거 같습니다.
수고하셨어용...즐엠티
S-Gihun
approved these changes
May 9, 2025
| }; | ||
|
|
||
| export const getLpComment = async(commentParams: LpCommentParams)=>{ | ||
| const {data} = await axiosInstance.get(`v1/lps/${commentParams.lpId}/comments`); |
| } bg-black flex-1 overflow-y-auto`} | ||
| > | ||
| <Outlet /> | ||
| {state?.backgroundLocation && <LpDetail />} |
There was a problem hiding this comment.
이런 식으로 구현한 이유가 따로 있을까요 ?
backgroundLocation으로 설정하면 어느 페이지에서 url만 바뀌고 Modal 형식으로 LpDetail이 뜨고 있는건지 헷갈리는 거 같아요
duwlsssss
approved these changes
May 9, 2025
| }, [inView, isFetching, hasNextPage, fetchNextPage]); | ||
|
|
||
|
|
||
| if (isLoading) { |
Contributor
There was a problem hiding this comment.
데이터를 처음 가져오는 부분에서 isLoading 을 사용했는데
isLoading은 에러가 발생했을 때도 true일 수 있어 안전하게 사용하려면 isPending으로 상태 체크를 하는 게 좋을 것 같아요!
| return( | ||
| <div className="grid sm:grid-cols-3 md:grid-cols-5 gap-2 px-2"> | ||
| {Array.from({ length: 20 }).map((_, idx) => ( | ||
| <LpBoardSkeleton key={idx} /> |
Contributor
There was a problem hiding this comment.
스켈레톤 컴포넌트에는 개수만 넘기고 컴포넌트 안에서 배열로 처리해줘도 깔끔할 것 같아요!
S-Gihun
reviewed
May 9, 2025
| <div className="grid sm:grid-cols-3 md:grid-cols-5 items-center justify-center px-2 gap-2"> | ||
| {lps?.pages?.map((page) => page.data.data)?.flat()?.map((lp:Lp) => ( | ||
| <div key={lp.id} className="relative"> | ||
| <LpBoard lp={lp} onClick={() => navigate(`/lps/${lp.id}`)} /> |
There was a problem hiding this comment.
import { useLocation } from "react-router-dom";
const location = useLocation(); // 현재 위치 기억
{lps?.pages?.map((page) => page.data.data)?.flat()?.map((lp: Lp) => (
<div key={lp.id} className="relative">
<LpBoard
lp={lp}
onClick={() =>
navigate(`/lps/${lp.id}`, {
state: { backgroundLocation: location },
})
}
/>
</div>
))}현재 Layout에서 사용하는 Modal 형식으로 사용하고 싶으면 이런 식으로 코드를 고쳐야할 거 같네요 !
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✏️ 작업 내용
#️⃣ 연관된 이슈
#35
📷 작업 결과
Week6.mp4
💡 함께 공유하고 싶은 부분
🤔 질문
✅ 워크북 체크리스트
✅ 컨벤션 체크리스트