경북대 FE_이효은_4주차 과제 Step2#54
Open
Hyoeunkh wants to merge 19 commits intokakao-tech-campus-2nd-step2:hyoeunkhfrom
Open
경북대 FE_이효은_4주차 과제 Step2#54Hyoeunkh wants to merge 19 commits intokakao-tech-campus-2nd-step2:hyoeunkhfrom
Hyoeunkh wants to merge 19 commits intokakao-tech-campus-2nd-step2:hyoeunkhfrom
Conversation
sjoleee
approved these changes
Jul 20, 2024
Comment on lines
+12
to
24
| const inputRef = useRef<HTMLInputElement>(null); | ||
|
|
||
| return ( | ||
| <OrderPageWrapper> | ||
| <Container maxWidth="1280px"> | ||
| <Inner> | ||
| <Left> | ||
| <GiftMessageSection orderHistory={orderHistoryToken} /> | ||
| <GiftMessageSection orderHistory={orderHistoryToken} inputRef={inputRef} /> | ||
| </Left> | ||
| <Right> | ||
| <PaymentSection orderHistory={orderHistoryToken} /> | ||
| <PaymentSection orderHistory={orderHistoryToken} inputRef={inputRef} /> | ||
| </Right> | ||
| </Inner> |
There was a problem hiding this comment.
현재는 inputRef를 끌어올려서 부모에서 각 섹션으로 넘겨주는 형태인데요,
submit, 유효성 검사에 필요한 모든 정보를 부모로 끌어올려 관리하는 것은 어떨까요?
현금 영수증 정보까지 모두 부모에서 관리하면 각 섹션은 각자가 해야하는 일에 집중할 수 있게 됩니다.
GiftMessageSection는 메시지를 입력하고, 관련 ui를 보여줍니다.
PaymentSection는 현금 영수증 정보를 입력하고, 결제를 처리하고, 관련 ui를 보여줍니다. (현금 영수증과 결제를 분리해도 괜찮을 것 같네요. 결제는 부모에서, 현금 영수증은 별도의 섹션으로 관리)
이제 각 섹션은 자신이 입력하는 데이터가 유효한지는 생각하지 않아도 됩니다.
근데 이러면 부모쪽에 책임이 집중된다는 단점이 있어서 완전히 좋다고 하기는 좀 그러네요...
저라면 부모로 옮기는 방식과 contextAPI 사용을 고려해봤을 것 같아요.
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.
안녕하세요 멘토님!
알려주신대로 rebase 사용하려 했지만 권한이 없다고 뜹니다. 알려주신 의도와 다른 방법을 사용한 건지 잘 모르겠네요,,
그래서 그냥 이전 커밋 기록이 남아있도록 제출했습니다..
cf72269 [docs: 2단계 README 작성]부터 2단계입니다!
늘 감사드립니다!