Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.

Commit 29fdadc

Browse files
authored
Merge branch 'master' into patch-1
2 parents 8e4c384 + 72a24eb commit 29fdadc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/view/use-isomorphic-layout-effect.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import { useLayoutEffect, useEffect } from 'react';
99
// `connect` to perform sync updates to a ref to save the latest props after
1010
// a render is actually committed to the DOM.
1111
const useIsomorphicLayoutEffect =
12-
typeof window !== 'undefined' ? useLayoutEffect : useEffect;
12+
typeof window !== 'undefined' &&
13+
typeof window.document !== 'undefined' &&
14+
typeof window.document.createElement !== 'undefined'
15+
? useLayoutEffect
16+
: useEffect;
1317

1418
export default useIsomorphicLayoutEffect;

0 commit comments

Comments
 (0)