Skip to content

Conversation

@seoyeon435
Copy link

  1. useWindowSize 구현
  2. useCountdown 구현
  3. useAlert 구현 (버튼을 누르면 "안뇽!! 내 인스타 아이디야 -> seoyeon_435 " alert 가 뜹니다)
image

export const useModal = () => {
// 여러분의 use{Something}을 만들어주세요!
// 정답은 없습니다. 커스텀훅의 필요성을 스스로 느껴보세요.
// 아이디어를 생각하고, 스스로 구현하다가 어려우면 손 들어주세요!

Choose a reason for hiding this comment

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

아이디어가 재밌는 것 같아요
필요없는 주석은 삭제해도 좋을 것 같아요

};
const [timeLeft, setTimeLeft] = useState(() => calculateTimeLeft(targetDate));
// return () => clearInterval(timer);
// }, [targetDate]);
Copy link

Choose a reason for hiding this comment

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

불필요한 주석은 삭제하는 게 좋을 것 같습니다!

Comment on lines +5 to +10
const modal = () => {
alert("안뇽!! 내 인스타 아이디야 -> seoyeon_435 ");
};

return { modal };

Copy link

Choose a reason for hiding this comment

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

매개변수를 받아서 다양한 메시지를 띄우도록 하는 방식도 좋을 것 같아요!

// 아이디어를 생각하고, 스스로 구현하다가 어려우면 손 들어주세요!
};
const modal = () => {
alert("안뇽!! 내 인스타 아이디야 -> seoyeon_435 ");
Copy link

Choose a reason for hiding this comment

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

버튼을 누르면 인스타 아이디가 뜨는 게 귀엽네요!
함수 이름을 showAlert() , showMessage() 처럼 직관적으로 해도 좋을 것 같네요

// 아이디어를 생각하고, 스스로 구현하다가 어려우면 손 들어주세요!
};
const modal = () => {
alert("안뇽!! 내 인스타 아이디야 -> seoyeon_435 ");

Choose a reason for hiding this comment

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

간단하지만 굉장히 직관적인 코드인 거 같아요 !! 인스타 아이디가 뜨는 것도 너무 귀여운 발상이에용
modal 이라는 함수명을 조금 더 구체적으로 작성하는 것도 좋을 거 같아요 !

Copy link

@Soi-coding Soi-coding left a comment

Choose a reason for hiding this comment

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

과제하시느라 수고하셨어요!

Choose a reason for hiding this comment

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

메세지 내용이 귀여워요! 함수명을 modal이라고 하셨지만 기본 alert만 사용하고 계셔서 함수명을 다르게 바꾸면 좋을 것 같아요!

// 아이디어를 생각하고, 스스로 구현하다가 어려우면 손 들어주세요!
};
const modal = () => {
alert("안뇽!! 내 인스타 아이디야 -> seoyeon_435 ");

Choose a reason for hiding this comment

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

아이디어가 너무 귀여워요!! 버튼을 누르면 alert창이 뜨도록 구현한 점이 인상 깊습니다. ui를 따로 만들어서 새로운 모달창이 뜨도록 해봐도 재밌을 것 같아요!

// 아이디어를 생각하고, 스스로 구현하다가 어려우면 손 들어주세요!
};
const modal = () => {
alert("안뇽!! 내 인스타 아이디야 -> seoyeon_435 ");

Choose a reason for hiding this comment

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

반환 객체의 key가 modal보다는 openModal 같은 이름이 더 직관적일 것 같습니다

Choose a reason for hiding this comment

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

모달창 띄우기를 커스텀훅으로 지정한점이 인상 깊은 것 같아요! .jsx 파일 이름도 명확하게 바꿔서 설정해놓으면 더 좋을 것 같아용

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.