Skip to content

Commit

Permalink
feat(ui/hooks): useComposeRefs hook 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
sukvvon committed Aug 7, 2024
1 parent c595bc8 commit ee99d47
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/ui/src/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable @stylistic/padding-line-between-statements */
export { useBoolean } from './use-boolean';
export { useCallbackRef } from './use-callback-ref';
export { useComposeRefs } from './use-compose-refs';
export { useDisclosure } from './use-disclosure';
export { useLayoutEffect } from './use-layout-effect';
export { usePosition, type Placement } from './use-position';
Expand Down
7 changes: 7 additions & 0 deletions packages/ui/src/hooks/use-compose-refs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { type Ref, useCallback } from 'react';
import { composeRefs } from '../utils';

export function useComposeRefs<T>(...refs: Ref<T>[]) {
// eslint-disable-next-line react-hooks/exhaustive-deps
return useCallback(composeRefs(...refs), refs);
}

0 comments on commit ee99d47

Please sign in to comment.