-
Notifications
You must be signed in to change notification settings - Fork 1
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
[3주차-ts] 이상형 with TS #6
base: main
Are you sure you want to change the base?
Changes from 1 commit
66e2629
8aeeaa6
fb0aeac
234f415
207dae4
fd2218a
bd9c992
9b64008
18a5293
622fd34
f150cc0
a51386f
673fbe0
1bf2548
9d18660
aa82b6a
9b14518
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,15 +21,19 @@ export default function Main() { | |
}; | ||
|
||
// 화면이 리렌더링 될 때 마다 참가자들 배열과 승리자들 배열 확인 | ||
fighterList.length === 0 && | ||
useEffect(() => { | ||
if (matchWinners.current.length >= 8) checkLists("8강"); | ||
else if (matchWinners.current.length >= 4) checkLists("4강"); | ||
else if (matchWinners.current.length >= 2) checkLists("결승"); | ||
else if (matchWinners.current.length === 1) { | ||
navigation("/complete", { state: {checkLists(), matchWinners} }); | ||
} | ||
}); | ||
|
||
useEffect(() => { | ||
if (fighterList.length === 0 && matchWinners.current.length >= 8) checkLists("8강"); | ||
else if (fighterList.length === 0 && matchWinners.current.length >= 4) checkLists("4강"); | ||
else if (fighterList.length === 0 && matchWinners.current.length >= 2) checkLists("결승"); | ||
else if (fighterList.length === 0 && matchWinners.current.length === 1) { | ||
console.log(matchWinners.current[0]); | ||
navigation("/complete", { | ||
// navigation에 값을 다중으로 넘겨주는 방법 | ||
state: { checkLists: checkLists("16강"), matchWinners: matchWinners }, | ||
}); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 내가 혠니랑 열띤 토론하고나서 이제 다시 찾아보니까 Common API reference - 리액트 navigate에서 보면 그래서 값을 다중으로 넘기려면 state: { checkLists: "16강", matchWinners: "이겻다" }, 이런식으로 얼마든지 가능한데! 혠니 코드는 함수랑 ref 자체를 넘겨받는거라 인식을 못하는 것같아! 여기서 state를 넘겨주지 말고 몬가 props로 넘기거나 그래야 할 것가튼데 흠흠 혹싀 이해 안데면 알랴주구 >.< There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 오 .... !! 값을 다중으로 넘기는 건 가능하되, 함수랑 ref 자체를 넘기는 건 안된다! 그러므로 props를 사용해야된단 뜻이겠지?! |
||
}); | ||
|
||
return ( | ||
<StyledRoot> | ||
|
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.
콘솔은 지워주셔도 좋을 것 같습니다😋😋