Skip to content

Conversation

@qkrdmsthff
Copy link

@qkrdmsthff qkrdmsthff commented Nov 12, 2025

✅ 워크북 체크리스트

  • 모든 핵심 키워드 정리를 마쳤나요?
  • 핵심 키워드에 대해 완벽히 이해하셨나요?
  • 이론 학습 이후 직접 실습을 해보는 시간을 가졌나요?
  • 미션을 수행하셨나요?
  • 미션을 기록하셨나요?

✅ 컨벤션 체크리스트

  • 디렉토리 구조 컨벤션을 잘 지켰나요?
  • pr 제목을 컨벤션에 맞게 작성하였나요?
  • pr에 해당되는 이슈를 연결하였나요?(중요)
  • 적절한 라벨을 설정하였나요?
  • 파트장에게 code review를 요청하기 위해 reviewer를 등록하였나요?
  • 닉네임/main 브랜치의 최신 상태를 반영하고 있는지 확인했나요?(매우 중요!)

📌 주안점

Comment on lines +3 to +11
export const postImage = async (file: string | Blob) => {
const formData = new FormData();
formData.append('file', file);

const response = await axiosInstance.post('/uploads', formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 이번 미션에서 서버에 파일을 보내는 방법을 잘 모르겠어서 어렵게 느껴졌어요. 이렇게 FormData로 파일을 담아 post 하는 방법이 있다는걸 처음 알았네요.. 저도 다시 구현해 봐야겠어요.

alert("댓글 수정에 실패하였습니다 !! 다시 시도해 주세요.");
}
});

Copy link
Collaborator

@sunnyinha sunnyinha Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useMutation이 컴포넌트 내부에 포함되어 있어서 UI 코드와 상태 관리 로직이 한 파일에 섞이면서 컴포넌트 길이가 조금 길어지고 있습니다. mutation 로직을 별도의 hooks 파일로 분리해두면 가독성과 유지보수 측면에서 더 유리해서한번 분리해보시는 것을 추천드립니다!
또한 지금은 쿼리 키가 많지 않아서 괜찮지만 쿼리 키가 많아지면 문자열로 직접 넣기보다 queryKeys.ts에서 중앙 관리하면 전체 쿼리 구조를 일관되게 유지할 수 있고, invalidate / getQueryData 시 실수나 누락을 줄일 수 있어서 시간 되실 때 구조 개선 방향으로 한번 고민해보셔도 좋을 것 같아요!

@sunnyinha
Copy link
Collaborator

sunnyinha commented Nov 16, 2025

치치 이번 주차도 코드 직접 짜보려고 노력해주셔서 너무 멋집니다!! PR 오른쪽에 Development 7주차에 연결해주시고 머지해주세요~

@qkrdmsthff qkrdmsthff merged commit a5d1e9a into UMC-Inha:치치/main Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chapter07_Tanstack Query 입문 2편: useMutation과 Optimistic Update

3 participants