-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
경북대 FE_안희정_4주차 과제 #66
Open
anheejeong
wants to merge
13
commits into
kakao-tech-campus-2nd-step2:anheejeong
Choose a base branch
from
anheejeong:feat/step4
base: anheejeong
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
경북대 FE_안희정_4주차 과제 #66
anheejeong
wants to merge
13
commits into
kakao-tech-campus-2nd-step2:anheejeong
from
anheejeong:feat/step4
Conversation
This file contains 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
minsour
reviewed
Jul 21, 2024
Comment on lines
+7
to
+15
export const useCurrentProduct = ({ productId }: Props) => { | ||
const { data, isLoading, isError } = useGetProductsDetail({ productId: productId }); | ||
|
||
const isRender = useMemo(() => { | ||
if (!data && isError) return true; | ||
if (isLoading || isError) return false; | ||
if (!data) return false; | ||
return true; | ||
}, [data, isLoading, isError]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
질문주신 부분을 여기죠?
useCurrentProductOption 내부의 아래 코드와 if문의 조건들이 다른데 왜 다르게 되는지에 대한 질문을 하신걸로 이해했는데요!
const isRender = useMemo(() => {
if (!dataOption && isError) return true;
if (isLoading || isError) return false;
if (!dataOption) return false;
return true;
}, [dataOption, isLoading, isError]);
if문 조걸들이 같은것 같은데 제가 질문을 잘못 이해한 걸까요?
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.
안녕하십니까, 멘토님! Step 1,2, 3를 나눠서 제출하려고 하다보니 Step1과 Step2에 하드코딩으로 되어있는 부분이 너무 많아 흐름이 매끄럽지 못하다 느껴 한번에 제출하게 되었습니다🥹!
특별한 issue는 따로 없었지만, 과제를 진행하면서 한 가지 궁금증이 들었던 부분은
src/api/hooks/useGetRankingProducts.ts 부분에서 useEffect 부분입니다.
해당 파일은 예시 파일로 제공된 파일이라, 이미 짜여져있는 코드였는데 동일한 방식으로 isLoading과 isError를 보여주며 data 렌딩을 기다리려고 비슷하게 코드를 짜보았는데(src/api/hooks/useGetProductDetail)
src/pages/Theme/index.tsx에서는 마지막에 isRender가 true로 바뀌는데,
src/pages/ProductDetail/index.tsx에서는 isRender가 계속 false로 떠서
src/hooks/useCurrentTheme.ts의 조건문과 다르게 src/hooks/useCurrentProduct.ts에서는 제일 위에 if (!data && isError) return true; 이 조건문을 추가해주어 해결하였습니다.
혹시 어떤 부분의 차이로 해당 if문이 없어도 isRender이 true로 바뀌고 currentProduct 조건문으로 내려갈 수 있는 건지 알고싶습니다!
감사합니다☺️