-
Notifications
You must be signed in to change notification settings - Fork 18
[문창기] sprint 12 #187
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
[문창기] sprint 12 #187
The head ref may contain hidden characters: "Next-\uBB38\uCC3D\uAE30-sprint12"
Conversation
… 관련 작업, readme 보완
dongqui
left a comment
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.
창기님 고생 많으셨습니다~!! 👍
| <label htmlFor="userEmail" className="text-sm font-bold md:text-lg"> | ||
| 이메일 | ||
| </label> | ||
| <input |
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.
컴포는트를 잘 활용해주세요~! :)
| } | ||
|
|
||
| if (currentImg) { | ||
| imageUploadMutation(currentImg, { |
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.
해당 부분도 서버에서 처리하면 코드가 많이 줄어들 거 같네요!
| const imagePreview = new FileReader(); | ||
| imagePreview.onloadend = () => { | ||
| if (imagePreview.result && typeof imagePreview.result === "string") { | ||
| setValue("postImg", imagePreview.result); |
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.
postImg가 어디에 쓰이는지 잘 모르겠습니다 previewImage는 내부에서만 쓰여도 충분할 거 같아요.
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.
error도 마찬가지입니다. 내부 상태와 외부 상태가 동시에 있어서 따라가기가 힘들어요!
| setValue: UseFormSetValue<z.infer<typeof addBoardSchema>>; | ||
| register: UseFormRegister<z.infer<typeof addBoardSchema>>; | ||
| watch: UseFormWatch<z.infer<typeof addBoardSchema>>; | ||
| errors: FieldErrors<z.infer<typeof addBoardSchema>>; |
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.
바깥 로직과 너무 결합된 거 같아요. onChange, error 등의 프랍들만 넣어도 밖에서 충분히 해결할 수 있을 거 같습니다!
| if (imagePreview.result && typeof imagePreview.result === "string") { | ||
| setValue("postImg", imagePreview.result); | ||
| setPreviewSrc(imagePreview.result); | ||
| setCurrentImg(file); |
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.
register를 쓰면서 uncontrolled인듯 하나 사실상 controlled 같이 쓰이고 있는 거 같아요! 다시 한 번 고민해보시면 좋을 거 같습니다 🤔
| @@ -0,0 +1,32 @@ | |||
| import { useEffect, useRef, useState } from "react"; | |||
|
|
|||
| export const useObserver = (callback: () => void) => { | |||
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.
👍
| } | ||
|
|
||
| export const useFavoriteCount = ({ id, setNewFavoriteCount, location }: FavoriteCountProps) => { | ||
| const requestUrl = location === "board" ? `/articles/${id}/like` : `/products/${id}/favorite`; |
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.
흠..!? 키 값은 하나인데 두 개의 데이터를 다루고 있군요..!?
| const formData = new FormData(); | ||
| formData.append("keyword", values.userSearch || ""); | ||
|
|
||
| const response = await itemSearch(formData); |
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.
현재 상태로는 서버액션을 사용하는 이점이 아무것도 없어 보여요! 불필요하게 중간 api를 하나 더 거치고 있을 뿐입니다..!
| }, [itemId]); | ||
| }; | ||
|
|
||
| useEffect(() => { |
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.
컴포넌트화 하고 해당 로직도 같이 들어가면 좀 더 깔금할 거 같네요!
스프린트 미션 12
요구사항
배포 웹사이트: https://codeit-nextjs-mission.vercel.app/
기본
심화
변경사항
스크린샷
멘토에게