From b40717cafdec42a88ad31e91e97f846e8670777b Mon Sep 17 00:00:00 2001 From: hayoung123 <67357426+hayoung123@users.noreply.github.com> Date: Thu, 3 Jun 2021 19:32:44 +0900 Subject: [PATCH] =?UTF-8?q?[#49]fix.=20=EB=9D=BC=EC=9A=B0=ED=84=B0=20link?= =?UTF-8?q?=20reload=20=EC=98=A4=EB=A5=98=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FE/airbnb/src/components/header/form/FormGuest.tsx | 6 +----- FE/airbnb/src/hooks/useToggle.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 5 deletions(-) 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;