-
Notifications
You must be signed in to change notification settings - Fork 2
Perf: 내 편지함 탄스택 쿼리 적용 #50
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| import { forwardRef } from 'react'; | ||
| import { twMerge } from 'tailwind-merge'; | ||
|
|
||
| interface LetterWrapperProps { | ||
|
|
@@ -7,20 +8,23 @@ interface LetterWrapperProps { | |
| onClick?: (e: React.MouseEvent<HTMLElement>) => void; | ||
| } | ||
|
|
||
| const LetterWrapper = ({ isSender = false, className, children, onClick }: LetterWrapperProps) => { | ||
| return ( | ||
| <article | ||
| className={twMerge( | ||
| 'relative flex overflow-hidden rounded-sm p-4', | ||
| isSender ? 'letter-sender-bg' : 'letter-receiver-bg', | ||
| className, | ||
| )} | ||
| onClick={onClick} | ||
| > | ||
| <div className="z-10 w-full">{children}</div> | ||
| <div className="absolute inset-0 z-0 bg-white/50 blur-xl" /> | ||
| </article> | ||
| ); | ||
| }; | ||
| const LetterWrapper = forwardRef<HTMLDivElement, LetterWrapperProps>( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. forwardRef는 처음 보는데 부모 컴포넌트에서 자식 컴포넌트의 ref객체를 사용하기 위해 쓰는건가용??
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 맞아요! |
||
| ({ isSender = false, className, children, onClick }, ref) => { | ||
| return ( | ||
| <article | ||
| className={twMerge( | ||
| 'relative flex overflow-hidden rounded-sm p-4', | ||
| isSender ? 'letter-sender-bg' : 'letter-receiver-bg', | ||
| className, | ||
| )} | ||
| onClick={onClick} | ||
| ref={ref} | ||
| > | ||
| <div className="z-10 w-full">{children}</div> | ||
| <div className="absolute inset-0 z-0 bg-white/50 blur-xl" /> | ||
| </article> | ||
| ); | ||
| }, | ||
| ); | ||
|
|
||
| export default LetterWrapper; | ||
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.
이건 뷰에 특정 컴포넌트가 있는지 없는지 확인을 쉽게 하게 해주는 라이브러리입니다! 이걸 적용해서 스크롤 됐을떄 마지막 요소가 뷰에 있는지 확인하고, 있으면 다음 페이지 api 요청을 하는 로직입니다!