-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/use unmount 추가 #14
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
Conversation
src/hooks/useUnmount.ts
Outdated
* @param callback 언마운트 시에 호출될 함수 | ||
*/ | ||
|
||
const useUnmount = (callback: () => void) => { |
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.
useUnmountCallback, useUnmountEffect
[P2] 훅의 역할이 좀 더 명확하게 드러나도록 위와 같이 이름을 지어보는 건 어떨까요?
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.
좋은 생각이에유! useUnmountEffect가 더 와닿는 이름인것 같아서 그걸로 초이스하겠습니다~.~
b925359에서 변경되었어요!
src/hooks/useUnmount.ts
Outdated
return () => { | ||
if (callbackRef.current) { | ||
callbackRef.current(); | ||
} |
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.
callbackRef.current = null;
[P2] 클린업 단계에서 callbackRef를 초기화시키는 건 어떨까요? 메모리 누수를 방지할 수 있을 것 같습니다!
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.
10eb498에서 수정되었습니다!
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.
수고하셨습니다! 자주 쓰일 훅이네요:)
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.
멋진 훅이네요 고생하셨습니다!
…project/use-react-hooks into feature/use-unmount
👾 Pull Request
1️⃣ Spec
2️⃣ 변경 사항
3️⃣ 예시 코드
4️⃣ 관련 문서 (선택 사항)