Skip to content
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(react): useCombinedRefs, useScrollEvent 훅 추가 #44

Merged
merged 3 commits into from
Aug 22, 2021

Conversation

evan-moon
Copy link
Member

변경사항

@lubycon/ui-kit에서 사용하던 useCombinedRefs, useScroll 훅을 @lubycon/react에 옮겼습니다.

useCombinedRefs

여러 개의 ref를 합칠 수 있는 훅입니다.

const Foo = forwardRef((props, fowardedRef) => {
  const ref = useRef();
  const combinedRef = useCombinedRefs(fowardedRef, ref2);
 
  // div가 업데이트되면 ref, fowardedRef 둘 다 업데이트 됨
  return <div ref={combinedRef} />
});

useScrollEvent

const Foo = () => {
  const ref = useRef();
  const callback = useCallback(() => {
    console.log('scroll 이벤트 발생');
  });

  useScrollEvent(ref, callback);

  return <div ref={ref} />;
};

집중적으로 리뷰 받고 싶은 부분이 있나요?

🙇

Copy link
Member

@zi-gae zi-gae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

정연님 리뷰까지 확인했습니닫ㄸㄸㄸㄸ LGTM :)

@zi-gae zi-gae merged commit d2ac59a into main Aug 22, 2021
@zi-gae zi-gae deleted the feat/migrate-from-ui-kit branch August 22, 2021 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants