-
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
Feature/share 결과 공유 페이지 #7
Conversation
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.
LGTM! 😊
import { forwardRef } from "react"; | ||
|
||
import { AppBarElement } from "./AppBar.style"; | ||
|
||
export interface AppBarProps extends React.ComponentProps<"div"> { | ||
children: React.ReactNode; | ||
} | ||
|
||
export const AppBar = forwardRef<HTMLDivElement, AppBarProps>(({ children, ...props }, ref) => { | ||
return ( | ||
<AppBarElement ref={ref} {...props}> | ||
{children} | ||
</AppBarElement> | ||
); | ||
}); |
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.
forwardRef 는 리액트 노드의 ref 속성에 접근할때
예를들어 input, button 과 같은 경우에만 사용하면 될것 같습니다!
ref props 는 일반적인 props 와 다르게 React Fiber Node 에 저장되기 때문에 forwardRef 로 전달하는거에요!
그냥 styled component 를 사용하면 ref 도 자동으로 전달해주니 저런식으로 굳이 짤 필요는 없다고 생각됩니다!
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.
이해됐습니다! 다음 PR과 함께 수정하겠습니다!
구현한 기능
논의하고 싶은 내용
기타