Skip to content

Commit

Permalink
Check if window.document.createElement exists to determine if renderi…
Browse files Browse the repository at this point in the history
…ng on server or not (reduxjs#1283)
  • Loading branch information
tobhult authored and timdorr committed May 13, 2019
1 parent cf46eaf commit 4b02f92
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/connectAdvanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ const initStateUpdates = () => [null, 0]
// `connect` to perform sync updates to a ref to save the latest props after
// a render is actually committed to the DOM.
const useIsomorphicLayoutEffect =
typeof window !== 'undefined' ? useLayoutEffect : useEffect
typeof window !== 'undefined' &&
typeof window.document !== 'undefined' &&
typeof window.document.createElement !== 'undefined'
? useLayoutEffect
: useEffect

export default function connectAdvanced(
/*
Expand Down

0 comments on commit 4b02f92

Please sign in to comment.