-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: Confirm 컴포넌트 구현 #22
Conversation
✅ Deploy Preview for boolti-admin ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for boolti-super-admin ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for boolti-preview ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
|
||
return useCallback( | ||
(message: React.ReactNode, buttonText?: ConfirmButtonText) => { | ||
return new Promise<boolean>((resolve) => { |
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.
Promise
로 만든 이유가 따로 있을까?
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.
const result = confirm()
의 형태로 Confirm 컴포넌트를 사용하려면, 컴포넌트가 띄워지고, 확인/취소 버튼 중 어떤 것이 눌렸는지 결과가 바로 반환되는 것이 아니기 때문에 Promise로 resolve해야 한다고 생각했어. 다른 방법이 있을까?
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.
이해했다! 굿굿 나중 생각해서 훨씬 좋을 것 같네!
Confirm 컴포넌트 구현
사용 예시는 HomePage.tsx를 참고해주세요.