Skip to content

Conversation

@bhoh032019
Copy link
Collaborator

요구사항

기본

  • 스프린트 미션 1 ~ 7에 대해 typescript를 적용해주세요

심화

  • any타입을 최소한으로 써주세요

주요 변경사항

스크린샷

image

멘토에게

  • 셀프 코드 리뷰를 통해 질문 이어가겠습니다.

@bhoh032019 bhoh032019 requested a review from kiJu2 November 16, 2024 02:15
@bhoh032019 bhoh032019 added the 매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다. label Nov 16, 2024
@kiJu2
Copy link
Collaborator

kiJu2 commented Nov 18, 2024

수고 하셨습니다 ! 스프리트 미션 하시느라 정말 수고 많으셨어요.
학습에 도움 되실 수 있게 꼼꼼히 리뷰 하도록 해보겠습니다. 😊


function AllItemsSection() {
const [orderBy, setOrderBy] = useState('recent');
const [orderBy, setOrderBy] = useState<ProductOrderBy>('recent');
Copy link
Collaborator

Choose a reason for hiding this comment

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

크으 굳굳 ! 타입을 확인해보니 "recent" | "favorite"군요 !

명확한 타입입니다 ! 굳굳 ~! 👍


function BestItemSection() {
const [itemList, setItemList] = useState([]);
const [itemList, setItemList] = useState<Product[]>([]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

굳굳 ! 여러 곳에서 사용될 타입을 정의함으로서 재사용성을 높였군요 ! 👍👍

Comment on lines +6 to +11
interface FileInputProps {
name: string;
value: File | null;
initialPreview: string | null;
onChange: (name: string, value: File | null) => void;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

훌륭합니다. 😊 깔끔한 타입이예요.


const handleChange = (e) => {
const nextValue = e.target.files[0];
const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

함수 이벤트 타입도 명확하구요 !

function FileInput({ name, value, initialPreview, onChange }: FileInputProps) {
const [preview, setPreview] = useState(initialPreview);
const inputRef = useRef();
const inputRef = useRef<HTMLInputElement | null>(null);
Copy link
Collaborator

Choose a reason for hiding this comment

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

ref 타입도 명확하네요 ㅠㅠ

@kiJu2
Copy link
Collaborator

kiJu2 commented Nov 18, 2024

어우.. 병훈님 이번 코드. 제 눈에는 딱히 흠 잡을데가 보이지 않는군요 ㄷㄷ
훌륭합니다. 보통 타입을 지정할 때 리액트 기본 타입의 존재를 모르고 작성하는 경우도 많은데 이벤트 객체 타입 지정하시는거 보고 놀랐어요.
또한, string이 아닌 유니온 타입으로 더욱 명확한 타입을 주신 점 또한 매우 좋았습니다 !

금방 적응하시고 아마 빠르게 멋진 개발자가 되실거라 생각됩니다 ㅎㅎ 😊😊

그 간 함께해주셔서 감사했습니다 ! 앞으로도 개발자 꽃길 되시길 기원드립니다 ! 😊

@kiJu2 kiJu2 merged commit 8c45192 into codeit-bootcamp-frontend:React-오병훈 Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants