Skip to content

Conversation

@jihyun01
Copy link

No description provided.

Copy link
Owner

@yesjin-git yesjin-git left a comment

Choose a reason for hiding this comment

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

고생하셨습니다! 요구사항에 맞게 잘 개발해주셨습니다. A-드립니다.

컴포넌트 재사용 측면에서 1을 더하는 컴포넌트와 2를 더하는 컴포넌트를 따로 만들지 않고 props로 interval값만 넘겨줘서 작성할 수 있습니다. 자세한 내용은 답안지를 확인해 주세요.

추가적으로 커맨트 드린바와 같이 component will unmount에 clock을 멈추는 함수를 실행시킬 수 있도록 해야된다는 점 잘 기억해주세요.

this.setState({ date: new Date() });
}, 1000);
}
handleDecrease() {
Copy link
Owner

Choose a reason for hiding this comment

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

stop clock 같은 매소드 명이 더 좋을 것 같습니다.

}
handleDecrease() {
this.intervalId = clearInterval(() => {
this.setState({ date: Date() });
Copy link
Owner

Choose a reason for hiding this comment

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

clear interval 은 component will unmount 에서도 꼭 콜되어야 합니다.

https://reactjs.org/docs/state-and-lifecycle.html 이 부분을 참고해 주세요.

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.

2 participants