Skip to content

Commit 2b835d6

Browse files
committed
[fixed] typeof returns a string (canUseDOM).
1 parent cd10612 commit 2b835d6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/components/Modal.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import SafeHTMLElement from '../helpers/safeHTMLElement';
88
export const portalClassName = 'ReactModalPortal';
99
export const bodyOpenClassName = 'ReactModal__Body--open';
1010

11-
const canUseDOM = typeof window !== undefined;
11+
const canUseDOM = typeof window !== 'undefined' || (
12+
typeof document !== 'undefined' && document.createElement
13+
);
14+
1215
const isReact16 = ReactDOM.createPortal !== undefined;
1316
const createPortal = isReact16 ?
1417
ReactDOM.createPortal :

0 commit comments

Comments
 (0)