Skip to content

Conversation

@KimYeonBee
Copy link

  1. [Refactor: useWindowSize로 리팩토링]
    1번 실습 내용을 해결하였으나, 수정사항이 있어 3번에서 한 번 더 수정하였습니다.

  2. [Refactor: useCountdown으로 리팩토링]
    2번 실습 내용을 해결하였으나, 수정사항이 있어 3번에서 한 번 더 수정하였습니다.

  3. [Feature: useSetColor 구현]
    배경색 바꾸기 버튼을 누르면 배경색이 랜덤으로 바뀝니다.

@KimYeonBee KimYeonBee changed the title Yeonbee kim [김연비] Jul 30, 2025
@KimYeonBee KimYeonBee changed the title [김연비] [김연비] 커스텀 훅 실습 Jul 30, 2025

Choose a reason for hiding this comment

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

잘 만든 것 같아요
useSomething 말고 다른 파일명으로 바꾸면 좋을 것 같아요
필요 없는 주석도 삭제하면 좋을 것 같습니다

const g = Math.floor(Math.random() * 256);
const b = Math.floor(Math.random() * 256);
setBgColor(`rgb(${r}, ${g}, ${b})`);
console.log(bgColor);
Copy link

@jyeon03 jyeon03 Aug 4, 2025

Choose a reason for hiding this comment

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

배경색 신박하네요! 콘솔 로그는 삭제하는 것이 더 깔끔할 것 같아요!

Comment on lines +11 to +16
const changeColor = () => {
const r = Math.floor(Math.random() * 256);
const g = Math.floor(Math.random() * 256);
const b = Math.floor(Math.random() * 256);
setBgColor(`rgb(${r}, ${g}, ${b})`);
console.log(bgColor);
Copy link

Choose a reason for hiding this comment

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

랜덤 배경색을 직접 훅으로 분리한 게 신선합니닷!
useEffect로 console를 옮겨보는 것 도 좋을 것 같습니다

const g = Math.floor(Math.random() * 256);
const b = Math.floor(Math.random() * 256);
setBgColor(`rgb(${r}, ${g}, ${b})`);
console.log(bgColor);
Copy link

Choose a reason for hiding this comment

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

랜덤 컬러를 생성하는 게 재밌네요.
useRandomColor와 같이 직관적인 이름을 사용해도 좋을 것 같네요!

const changeColor = () => {
const r = Math.floor(Math.random() * 256);
const g = Math.floor(Math.random() * 256);
const b = Math.floor(Math.random() * 256);

Choose a reason for hiding this comment

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

Math.random()을 256으로 곱하고 Math.floor()로 반올림해서 RGB 범위를 정확히 맞춘 점이 좋은 거 같아요 !

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.

r, g, b 숫자를 랜덤하게 뽑아서 배경색을 바꾸는 아이디어가 좋은 것 같아요!

bgColor: "",
});

const changeColor = () => {

Choose a reason for hiding this comment

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

기본 r,g,b 색상을 정의한 후 랜덤 색상을 출력 가능하게 구현한 점이 깔끔하고 인상 깊습니다!

const r = Math.floor(Math.random() * 256);
const g = Math.floor(Math.random() * 256);
const b = Math.floor(Math.random() * 256);
setBgColor(`rgb(${r}, ${g}, ${b})`);

Choose a reason for hiding this comment

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

RGB 값을 랜덤으로 생성하는 로직이 직관적이고 이해하기 쉽게 작성된 것 같아요!

const changeColor = () => {
const r = Math.floor(Math.random() * 256);
const g = Math.floor(Math.random() * 256);
const b = Math.floor(Math.random() * 256);

Choose a reason for hiding this comment

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

Math.random()과 rgb() 문자열 조합으로 동작이 명확하고 재미있는 것 같습니다

Choose a reason for hiding this comment

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

만든 커스텀훅과 맞게 파일명을 바꾸면 코드이해에 더 쉬울 것 같아요!

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.