-
Notifications
You must be signed in to change notification settings - Fork 3
Feat/#213 menubar #214
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/#213 menubar #214
Conversation
Release/1.3 from forked Release/1.3
joohaem
left a comment
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 openElement = useOutClickCloser({ | ||
| handleOutClickCloser: () => { | ||
| closeMenuBar(); | ||
| }, | ||
| }); |
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.
아 이제 아웃클릭 코드들 보니까 되게 신기하게 짰네???
먼가 더 보편적인 방법으로는,
export default function useOutClickCloser(handleOutClickCloser: () => void;) {이렇게 props 인자가 아닌, 콜백함수 인자로 받아와서
| const openElement = useOutClickCloser({ | |
| handleOutClickCloser: () => { | |
| closeMenuBar(); | |
| }, | |
| }); | |
| const outClickRef = useOutClick(closeMenuBar); //ref 임을 명시해주는 변수명이 더 좋을 것 같아! |
나라면 이런 식으로 사용할 것 같다 !!
객체로 감싸서 넘겨주는 게, 그 "객체 안에 내용"만 바뀌면 "바뀐 줄 모르는" 현상이 일어나서
저렇게 인자 인수 형태로 넘겨주는 게 더 좋지 않을까 싶다!
이 외에도, 컴포넌트에서도 prop로 넘겨줄 때 객체형보다는 최대한 원시 자료형으로 객체를 분리해서 하나하나 넘겨주는 게 더 정확하고 효율적으로 렌더링(최적화) 되거든!
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.
useOutClick는 useOutClickCloser 요거를 바꿔서 쓴걸까요?-?
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.
바깥 영역 클릭할 때, 그 바깥 영역에서의 클릭을 어떻게 막을 수 있을까??
ex) 모바일에서 메뉴바 바깥에 카드를 누르면, 메뉴바가 없어지지만 카드뷰로도 넘어감
NYeonK
left a comment
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.
고마워용🥰❤
|
|
||
| export default function useOutClickCloser(props: UseOutClickCloserProps) { | ||
| const { handleOutClickCloser } = props; | ||
| type HandleOutClickCloser = () => 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.
아항 요로코롬 하는 거구나👀👀 배워갑니다아><
📌 내용
📌 질문할 부분
<link to = {} />여기 router 부분도 따로 빼려고 했는데 아래 코드에서ballotLists는 안에서 선언한거라 못빼더라구요?-?으떠한 방법이 있을까나요😵
`${routePaths.Vote}/${ballotLists?.data[0]._id}`📸 스크린샷