-
Notifications
You must be signed in to change notification settings - Fork 6
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
전병주 과제 #3
base: main
Are you sure you want to change the base?
전병주 과제 #3
Conversation
const InputChange = (event: React.ChangeEvent<HTMLInputElement>) => { | ||
setInputValue(event.target.value); | ||
}; |
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.
이 부분에서 event: 는 e로 축약해서 적을 수 있어요!
}; | ||
|
||
function App() { | ||
const [count, setCount] = useState(0); |
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.
할 일 개수를 관리하는 이 count 상태가 꼭 필요한지 생각해보세요!
const[count, setCount] = useState<number>(0);
이렇게 타입과 초기값을 명확히 추가하시는게 좋아요!
const DeleteItem = (id: number) => { | ||
const updatedList = itemList.filter((_, idx) => idx !== id); | ||
setItemList(updatedList); | ||
setCount(count - 1); | ||
}; |
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.
filter(_, idx) 부분에서 _ 이건 무엇을 의미하나요?
No description provided.