We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d195002 commit 57b056aCopy full SHA for 57b056a
frontend/src/components/common/Portal/Portal.tsx
@@ -9,9 +9,15 @@ type PortalProps = {
9
10
const Portal: FC<PropsWithChildren<PortalProps>> = memo(
11
({ isOpen, children }) => {
12
- const content = isOpen ? <S.Backdrop>{children}</S.Backdrop> : null;
+ const target = document.getElementById('portal-root');
13
14
- return createPortal(content, document.getElementById('portal-root')!);
+ if (target == null) {
15
+ return null;
16
+ }
17
+
18
+ return isOpen
19
+ ? createPortal(<S.Backdrop>{children}</S.Backdrop>, target)
20
+ : null;
21
}
22
);
23
0 commit comments