-
Notifications
You must be signed in to change notification settings - Fork 6
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-fe: Toast구현 #570
feat-fe: Toast구현 #570
Conversation
1724225170.163889 |
1724225179.002239 |
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.
멋진 토스트가 만들어졌네요. 감사합니다! 🙏
message: | ||
'Primary Alert Primary Alert Primary Alert Primary Alert! Primary Alert Primary Alert Primary Alert Primary Alert Primary Alert Primary Alert Primary Alert Primary !!! Alert Primary Alert Primary Alert Primary Alert Primary Alert Primary', |
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 handleAlert = useCallback( | ||
(type: ToastType) => (message: string) => { | ||
const id = idRef.current; | ||
setToastList((prev) => [...prev, { id, type, message }]); | ||
idRef.current += 1; | ||
|
||
setTimeout(() => removeToast(id), 4000); | ||
}, | ||
[], | ||
); |
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.
setTimeout
과 연계해서 toast id
값을 다룰 때 state
대신 ref
로 구현하신 부분에 대해서 추후 자세한 설명을 요청드리고 싶어요. 어떠한 원리로 인하여 state
는 문제가 생기고 ref
는 통과되는지 좀 더 살펴보고 싶습니다. 🙏
Co-authored-by: Jeongwoo Park <[email protected]>
Original issue description
목적
작업 세부사항
참고 사항
TOAST
closes #569