Skip to content

Commit f44222e

Browse files
committed
✨ feat: ref 타입 변경
1 parent bb7de78 commit f44222e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/hooks/useOutsideInteraction.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useCallback, MutableRefObject, useEffect, useRef } from 'react';
1+
import { useCallback, useEffect, useRef, RefObject } from 'react';
22

33
type EventType =
44
| 'mousedown'
@@ -22,14 +22,14 @@ const defaultEvents: EventType[] = ['mousedown', 'touchstart', 'keydown'];
2222
* @param {() => void} props.handleOutsideInteraction - 외부 interaction 발생 시 실행될 콜백 함수
2323
* @param {EventType[]} [props.events] - 감지할 이벤트 (default :['mousedown', 'touchstart', 'keydown'])
2424
*
25-
* @returns {React.MutableRefObject<HTMLElement | null>} element에 연결할 ref 객체
25+
* @returns {React.RefObject<HTMLElement>} element에 연결할 ref 객체
2626
*/
2727

2828
const useOutsideInteraction = ({
2929
handleOutsideInteraction,
3030
events = defaultEvents,
31-
}: UseOutsideInteractionProps): MutableRefObject<HTMLElement | null> => {
32-
const ref = useRef<HTMLElement | null>(null);
31+
}: UseOutsideInteractionProps): RefObject<HTMLElement> => {
32+
const ref = useRef<HTMLElement>(null);
3333

3434
const handleEvent = useCallback(
3535
(event: Event) => {

0 commit comments

Comments
 (0)