fix(v2): BrowserOnly should not return undefined (#3149)

This commit is contained in:
Sébastien Lorber 2020-07-28 20:17:47 +02:00 committed by GitHub
parent eeb5c93e15
commit d28a29f2c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,9 +14,9 @@ function BrowserOnly({
}: {
children?: () => JSX.Element;
fallback?: JSX.Element;
}): JSX.Element | undefined {
}): JSX.Element | null {
if (!ExecutionEnvironment.canUseDOM || children == null) {
return fallback || undefined;
return fallback || null;
}
return <>{children()}</>;