From 2e4aee995dd449b5d5c078e63cd54cb8a6e6d21d Mon Sep 17 00:00:00 2001 From: atomiks Date: Sun, 21 Jun 2020 08:31:32 +1000 Subject: [PATCH] fix: portal SSR --- src/Tippy.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Tippy.js b/src/Tippy.js index 3e6f2df..e3b9ce0 100644 --- a/src/Tippy.js +++ b/src/Tippy.js @@ -5,6 +5,7 @@ import { ssrSafeCreateDiv, toDataAttributes, deepPreserveProps, + isBrowser, } from './utils'; import {useMutableBox, useIsomorphicLayoutEffect} from './util-hooks'; import {classNamePlugin} from './className-plugin'; @@ -209,10 +210,13 @@ export default function TippyGenerator(tippy) { }, }) : null} - {createPortal( - render ? render(toDataAttributes(attrs), singletonContent) : content, - mutableBox.container, - )} + {isBrowser && + createPortal( + render + ? render(toDataAttributes(attrs), singletonContent) + : content, + mutableBox.container, + )} ); }