diff --git a/FE/airbnb/src/components/header/form/FormGuest.tsx b/FE/airbnb/src/components/header/form/FormGuest.tsx index 8203fa5bf..5cb78f642 100644 --- a/FE/airbnb/src/components/header/form/FormGuest.tsx +++ b/FE/airbnb/src/components/header/form/FormGuest.tsx @@ -48,10 +48,6 @@ const FormGuest = () => { resetGuests(); }; - const handleSubmitClick = (e: MouseEvent): void => { - e.stopPropagation(); - }; - const linkCondition = Object.values(reserveInfo as reserveInfoType).filter((v) => !v).length === 0; const linkURL = clientReserveAPI(reserveInfo as reserveInfoType); @@ -62,7 +58,7 @@ const FormGuest = () => { {isShowDeleteBtn && } -
+
{isFormOpened &&
검색
}
diff --git a/FE/airbnb/src/hooks/useToggle.ts b/FE/airbnb/src/hooks/useToggle.ts index 382659d6e..9a114eafc 100644 --- a/FE/airbnb/src/hooks/useToggle.ts +++ b/FE/airbnb/src/hooks/useToggle.ts @@ -34,6 +34,10 @@ const useToggle = ({ clickRef, toggleRef, isChekcInSelected }: refsType): toggle if (clickRef instanceof Array) { for (const elem of clickRef) { + if (!elem.current) { + setOpen(false); + return; + } if ( (elem.current as HTMLDivElement).contains(target as HTMLDivElement) && selectType === elem.current?.dataset.type @@ -47,6 +51,10 @@ const useToggle = ({ clickRef, toggleRef, isChekcInSelected }: refsType): toggle } } } else { + if (!clickRef.current) { + setOpen(false); + return; + } if ((clickRef.current as HTMLDivElement).contains(target as HTMLDivElement)) { setOpen((open) => !open); return;