This repository was archived by the owner on Nov 23, 2021. It is now read-only.
react hook 중복사용 에러 #163
Answered
by
minhoryang
Eomhyunjun
asked this question in
6 Q&A - 프론트엔드
|
제가 구현하려는 기능 상 훅안에 훅을 써서 그런 것 같은데, 도저히 해결 방법이 생각나질 않습니다. |
Answered by
minhoryang
Aug 12, 2021
Replies: 2 comments 4 replies
|
공유해주신 에러 메시지에는 https://ko.reactjs.org/docs/hooks-rules.html#only-call-hooks-from-react-functions |
1 reply
|
hook안에서 rendering code가 담겨있어서 더 그런것 같습니다. |
3 replies
Answer selected by
Eomhyunjun
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


hook안에서 rendering code가 담겨있어서 더 그런것 같습니다.
rendering code는 메인 컴포넌트 함수의 return에 다 몰아주시고, 그곳까지 로직을 끌고오셔야합니다.
로직을 계산하는건 useMemo/useState 안에서 진행하시구요.